That is the correct work around, use Shared Memory and a shared pthread mutex.

 

Daniel

 

 

From: Wharry, Brian J. [mailto:brian.wharry@ngc.com]
Sent: Tuesday, December 04, 2007 2:37 PM
To: dev@apr.apache.org
Subject: Global mutex problem on Linux

 

Hi,

 

We are having a problem with the global mutex on Linux (in this case, on Ubuntu).  Using APR v1.2.9, we are unable to get a global mutex to provide inter-process locking, where under Windows it works fine.  In searching the APR mailing list archive I've found some others who have had the same problem, but it seems like it has yet to be fixed:

 

http://www.mail-archive.com/dev@apr.apache.org/msg14979.html

http://marc.info/?l=apr-dev&m=113253835410578&w=2

 

 

We are running a test application and opening two separate instances of it from the command line.  Both apps attempt to create and lock a global mutex with the same name.  We do not get any errors or warnings for doing this, but the result was not what we expect.  Instead of one process being prevented from locking the mutex, the two processes act like they are accessing completely different mutexes and they are both allowed to simultaneously lock the mutex.

 

Does anyone know if this will be fixed?  Or are we doing something wrong?

 

I should note that one of our developers has worked around this problem by using an APR Shared Memory segment and thread mutexes.

 

Thanks!

Brian

 

brian.wharry@ngc.com