pthread_mutexattr_setpshared()

get process-shared state attribute of mutex attribute object 

Function


SYNOPSIS

#include <pthread.h>

int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared);


DESCRIPTION

The pthread_mutexattr_setpshared() function sets the process-shared state attribute in the specified mutex attribute object. The mutex's process-shared state determines whether the mutex can be used to synchronize threads within the current process or threads within all processes on the system. Valid settings for pshared include:

PTHREAD_PROCESS_PRIVATE  

Creates a mutex that can only be used to synchronize threads within the current process.

PTHREAD_PROCESS_SHARED  

Creates a mutex that can be used to synchronize threads within all processes on the system


PARAMETERS

attr 

Is the mutex attribute object.

pshared 

Is the mutex process-shared state attribute value; one of the values specified in the DESCRIPTION section.


RETURN VALUES

On success, pthread_mutexattr_setpshared() returns 0. On error, one of the following values is returned:

EINVAL 

attr is not an initialized mutex attribute object, or pshared is not a valid process-shared state setting.

EFAULT 

attr is an invalid pointer.

ENOTSUP 

pshared was set to PTHREAD_PROCESS_SHARED.


CONFORMANCE

POSIX P1003.1 (1996)


MULTITHREAD SAFETY LEVEL

MT-safe.


PORTING ISSUES

The PTHREAD_PROCESS_SHARED process-shared state is not currently supported; if this value is specified, the function returns ENOTSUP.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
pthread_mutex_init(), pthread_mutexattr_getpshared(), pthread_mutexattr_init()


PTC MKS Toolkit 10.3 Documentation Build 39.