1pthread_mutexattr_getpsharedL(i3b)rary Functions Manputahlread_mutexattr_getpshared(3)
2
3
4

NAME

6       pthread_mutexattr_getpshared,  pthread_mutexattr_setpshared  -  get/set
7       process-shared mutex attribute
8

LIBRARY

10       POSIX threads library (libpthread, -lpthread)
11

SYNOPSIS

13       #include <pthread.h>
14
15       int pthread_mutexattr_getpshared(
16                             const pthread_mutexattr_t *restrict attr,
17                             int *restrict pshared);
18       int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr,
19                             int pshared);
20

DESCRIPTION

22       These functions get and set the process-shared attribute in a mutex at‐
23       tributes  object.   This  attribute must be appropriately set to ensure
24       correct, efficient operation of a mutex created using  this  attributes
25       object.
26
27       The process-shared attribute can have one of the following values:
28
29       PTHREAD_PROCESS_PRIVATE
30              Mutexes  created  with  this  attributes object are to be shared
31              only among threads in the same process that initialized the  mu‐
32              tex.  This is the default value for the process-shared mutex at‐
33              tribute.
34
35       PTHREAD_PROCESS_SHARED
36              Mutexes created with this attributes object can  be  shared  be‐
37              tween  any threads that have access to the memory containing the
38              object, including threads in different processes.
39
40       pthread_mutexattr_getpshared() places the value of  the  process-shared
41       attribute of the mutex attributes object referred to by attr in the lo‐
42       cation pointed to by pshared.
43
44       pthread_mutexattr_setpshared() sets the value of the process-shared at‐
45       tribute of the mutex attributes object referred to by attr to the value
46       specified in pshared.
47
48       If attr does not refer to an initialized mutex attributes  object,  the
49       behavior is undefined.
50

RETURN VALUE

52       On success, these functions return 0.  On error, they return a positive
53       error number.
54

ERRORS

56       pthread_mutexattr_setpshared() can fail with the following errors:
57
58       EINVAL The value specified in pshared is invalid.
59
60       ENOTSUP
61              pshared is PTHREAD_PROCESS_SHARED but  the  implementation  does
62              not support process-shared mutexes.
63

STANDARDS

65       POSIX.1-2008.
66

HISTORY

68       POSIX.1-2001.
69

SEE ALSO

71       pthread_mutexattr_init(3), pthreads(7)
72
73
74
75Linux man-pages 6.05              2023-03-30   pthread_mutexattr_getpshared(3)
Impressum