Is it possible to share a pthread mutex between two distinct processes?
> > ie: some way to attach to one like you can attach to shared memory. > > Same question for condition variables. The answer is (as often happens) both YES and NO. Over time, the balance will shift strongly towards YES. The POSIX standard provides an option known commonly as “pshared”, which, if supported on your implementation, allows you to allocate a pthread_mutex_t (or pthread_cond_t) in shared memory, and initialize it using an attributes object with a specific attribute value, such that two processes with access to the shared memory can use the mutex or condition variable for synchronization. Because this is an OPTION in the POSIX standard, not all implementations will provide it, and you cannot safely count on it. However, the Single UNIX Specification, Version 2 (UNIX 98) requires that this POSIX option be supported on any validated UNIX 98 implementation.