pthread_mutexattr_setpshared Subroutine


Sets the value of the processshared attribute of a mutex attributes

Note:	This subroutine is not implemented in AIX. It always returns


Threads Library (libpthreads.a)



int pthread_mutexattr_setpshared (attr, pshared)
pthread_mutexattr_t *attr;
int pshared;


The pthread_mutexattr_setpshared subroutine sets the value of the
process-shared attribute of the mutex attributes object attr. This
attribute specifies the process sharing of the mutex created with
this attributes object.

Note:	The pthread.h header file must be the first included file of
each source file using the threads library.


attr	Specifies the mutex attributes object.

pshared	Specifies the process sharing to set. It must have one of
the following values:

PTHREAD_PROCESS_SHARED	Specifies that the mutex can be used by any
thread that has access to the memory where it is allocated, even if
these threads belong to different processes.

PTHREAD_PROCESS_PRIVATE	Specifies that the mutex shall only be used
by threads within the same process as the thread that created it.
This is the default value.

Return Values

Upon successful completion, 0 is returned. Otherwise, an error code
is returned.

Error Codes

The pthread_mutexattr_setpshared subroutine is unsuccessful if the
following is true:

EINVAL	The attr or pshared parameters are not valid.

ENOSYS	The process sharing POSIX option is not implemented.

Implementation Specifics

This subroutine is part of the Base Operating System (BOS) Runtime.

The implementation of this subroutine is dependent on the process
sharing POSIX option. The process sharing POSIX option is not implemented
in AIX.

Related Information

The pthread_mutexattr_getpshared subroutine, pthread_mutexattr_init
subroutine, pthread_mutex_init subroutine.

Advanced Attributes.

Threads Library Options and Threads Library Quick Reference.