apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard <judicat...@gmail.com>
Subject Using global mutex
Date Wed, 01 Feb 2006 04:25:21 GMT
Hi,

I asked that question a while ago but I did not get any anwser.
I am using apr global mutex to synchronize across both processes and
threads. But the global mutex is not giving me mutual exclusion. I am not
sure if I am using the apr library calls correctly. Is that the way things
should be called ? Can someone please confirm ?

1.) apr_global_mutex_create() should be called only once by the first
process to use the mutex. Then, subsequent processes that want to use the
global mutex should call the function apr_global_mutex_child_init().
2.) The pool argument passed to apr_global_mutex_create() and
apr_global_mutex_child_init() in question#1 above is just a regular pool
that is local to each process.
3.) When everything is done, each process has to invoke
apr_global_mutex_destroy().

Do the processes using the global mutex have to be related in a
parent-children relationship ? I mean can one process create the global
mutex and then a totally separate process (i.e. not a child of the 1st one)
do a call to apr_global_mutex_child_init() on the global mutex ?

Thanks
Richard

Mime
View raw message