Interprocess synchronization

QNX SDP8.0Getting Started with the QNX OSDeveloperUser

Suppose two or more processes are sharing memory. They might want to synchronize the activities of different threads in different processes, just as they would between threads in the same process. All the various POSIX thread (pthread) synchronization tools available (mutexes, condition variables, barriers, etc) can be shared between proceses.

You must configure these mechanisms to support synchronization across processes by setting the PTHREAD_PROCESS_SHARED flag when you initialize them. So if you're using condvars, for instance, set this flag when calling pthread_condattr_init().

You can share semaphores between processes too. Unnamed semaphores (i.e., those created with sem_init()) must be initialized with the pshared parameter set to a non-zero value. Named semaphores (i.e., those created with sem_open()) are inherently shared between processes through the pathname space.

Page updated: