pthread_mutexattr_getpshared, pthread_mutexattr_setpshared — get/set process-shared mutex attribute
#include <pthread.h>
int
pthread_mutexattr_getpshared( |
const pthread_mutexattr_t *restrict attr, |
int *restrict pshared) ; |
int
pthread_mutexattr_setpshared( |
pthread_mutexattr_t *attr, |
int pshared) ; |
Note | |
---|---|
Compile and link with |
These functions get and set the process-shared attribute in a mutex attributes object. This attribute must be appropriately set to ensure correct, efficient operation of a mutex created using this attributes object.
The process-shared attribute can have one of the following values:
PTHREAD_PROCESS_PRIVATE
Mutexes created with this attributes object are to be shared only among threads in the same process that initialized the mutex. This is the default value for the process-shared mutex attribute.
PTHREAD_PROCESS_SHARED
Mutexes created with this attributes object can be shared between any threads that have access to the memory containing the object, including threads in different processes.
pthread_mutexattr_getpshared
() places the
value of the process-shared attribute of the mutex attributes
object referred to by attr
in the location pointed to
by pshared
.
pthread_mutexattr_setpshared
() sets the
value of the process-shared attribute of the mutex attributes
object referred to by attr
to the value specified in
pshared
.
If attr
does not
refer to an initialized mutex attributes object, the behavior
is undefined.
pthread_mutexattr_setpshared
() can fail
with the following errors:
The value specified in pshared
is invalid.
pshared is
PTHREAD_PROCESS_SHARED
but the implementation does not support process-shared
mutexes.
This page is part of release 5.11 of the Linux man-pages
project. A
description of the project, information about reporting bugs,
and the latest version of this page, can be found at
https://www.kernel.org/doc/man−pages/.
Copyright (c) 2017, Michael Kerrisk <mtk.manpagesgmail.com> %%%LICENSE_START(VERBATIM) Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Since the Linux kernel and libraries are constantly changing, this manual page may be incorrect or out-of-date. The author(s) assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. The author(s) may not have taken the same level of care in the production of this manual, which is licensed free of charge, as they might when working professionally. Formatted or processed versions of this manual, if unaccompanied by the source, must acknowledge the copyright and authors of this work. %%%LICENSE_END |