Sharing a Mutex Across Processes... Help?

Discussion in 'Programmer Misc' started by Mike, Jun 19, 2009.

  1. Mike

    Mike Guest

    I'm trying to port an application from Linux to Mac OS X that needs to
    be able to share a mutex across processes. On Linux I can do this
    easily by calling:

    pthread_mutexattr_setpshared
    (&pthreadmutexattrt,PTHREAD_PROCESS_SHARED);

    Obviously, when I tried to run with the code as is it didn't work.
    I've since found out that this is because OS X does not support
    sharing a mutex across processes.

    I'm hoping that someone out there knows a way I can do this on OS X.
    It's essential for my application. So far, I've not been able to find
    any Apple API that can do this (it appears they are all based on
    pthreads). The next closest thing I can find would be a named
    semaphore. Are they supported on all version of OS X? Or at least 10.3
    and higher?

    Also, if anyone has a better suggestion for how to do this I would
    love to hear it.

    Thanks,
    Mike
     
    Mike, Jun 19, 2009
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.