That is the correct work around, use Shared Memory and a shared pthread mutex.
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:
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.