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
