cc [options] -Kthread file
int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared); int pthread_mutexattr_getpshared(pthread_mutexattr_t *attr), int *pshared);
The pthread_mutexattr_getpshared function obtains the value of the process-shared attribute from the attributes object referenced by attr and stores it in the object referenced by the pshared parameter.
The attr parameter is a pointer to a mutex attributes object. For pthread_mutexattr_setpshared, pshared is an object in which the value of the process-shared attribute of attr is stored. For pthread_mutexattr_getpshared pshared is a pointer to the object in which the value of the process-shared attribute of attr is stored.
The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit a mutex to be operated upon by any thread that has access to the memory where the mutex is allocated, even if the mutex is allocated in memory that is shared by multiple processes. If the process-shared attribute is PTHREAD_PROCESS_PRIVATE (the default), the mutex will only be operated upon by threads created within the same process as the thread that initialized the mutex; if threads of differing processes attempt to operate on such a mutex, the behavior is undefined.
The pthread_mutexattr_setpshared function may fail if: