apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Erenkrantz <jus...@erenkrantz.com>
Subject Re: More problem with apr_proc_mutex
Date Sat, 05 Apr 2003 20:11:16 GMT
--On Saturday, April 5, 2003 2:21 AM -0800 Rohan Nandode <rnandode@yahoo.com> 

> I tried to use APR_LOCK_FCNTL locking method. But it
> is also giving same problems. What I observed in FCNTL
> locking is,
> 1. First process while creating a mutex opens a lock
> file, gets the fd and stores it for further
> operations. Then it unlinks the file.
> 2. When second process creates mutex, it again creates
> a file, stores the fd and deletes it.

Um, they need to share the same APR mutex object.  You can't create a mutex in 
process 1 and another in process 2 and expect it to work.  Process 1 and 
process 2 have to have the same mutex object.  Typically, you'd have process 0 
create the mutex, then fork process 1 and process 2.  This way, the children 
inherit the correct mutex.  You'd need to call apr_proc_mutex_child_init after 
the fork in each of the children.

APR's process locking semantics don't guarantee they will work on independent 
processes.  -- justin

View raw message