apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <...@rkbloom.net>
Subject Re: [PATCH] Re: apr_proc_mutex is broken
Date Tue, 19 Nov 2002 16:59:09 GMT


On 19 Nov 2002, Jeff Trawick wrote:

> I contemplated relatively-complex exit sequences so that children
> didn't exit until the test was over, but life is short, and these test
> programs should be short too.
>
> Besides adding crude error checking (crude better than none) for some
> critical APR calls, this patch ensures that apr_terminate() is not
> called in the child processes.
>
> In reality it would be nice to set up a proc mutex such that it is
> only destroyed up in the parent.  I suspect that this is reasonable
> default behavior, in which case no API change would be necessary.
> This could be implemented by storing a pid_t in the internal mutex
> representation and comparing that with getpid() in the cleanup before
> deciding whether to tell the kernel to destroy the mutex.  The exact
> details would vary between mutex types.  For file-based mutexes, there
> is no destroy syscall, and the existing logic to close the file still
> needs to be performed regardless of parent or child.

This would be a bad design change IMNSHO.  The library has no business
deciding when a mutex is destroyed, that is the role of the application
that created the mutex.  It isn't too hard to imagine a situation where a
mutex is created in the parent process, but the child processes are the
only ones that know anything at all about when it is safe to destroy it.
The app must be the thing that decides when to close the mutex.

Ryan


Mime
View raw message