1pthread_condattr_getpshareSdt(a3nCd)ard C Library Funcpttihornesad_condattr_getpshared(3C)
2
3
4
6 pthread_condattr_getpshared, pthread_condattr_setpshared - get or set
7 process-shared condition variable attributes
8
10 cc -mt [ flag... ] file... -lpthread [ library... ]
11 #include <pthread.h>
12
13 int pthread_condattr_getpshared(
14 const pthread_condattr_t *restrict attr,
15 int *restrict pshared);
16
17
18 int pthread_condattr_setpshared(pthread_condattr_t *attr,
19 int pshared);
20
21
23 The pthread_condattr_getpshared() function obtains the value of the
24 process-shared attribute from the attributes object referenced by attr.
25 The pthread_condattr_setpshared() function is used to set the process-
26 shared attribute in an initialized attributes object referenced by
27 attr.
28
29
30 The process-shared attribute is set to PTHREAD_PROCESS_SHARED to per‐
31 mit a condition variable to be operated upon by any thread that has
32 access to the memory where the condition variable is allocated, even if
33 the condition variable is allocated in memory that is shared by multi‐
34 ple processes. If the process-shared attribute is PTHREAD_PROCESS_PRI‐
35 VATE, the condition variable will only be operated upon by threads cre‐
36 ated within the same process as the thread that initialized the condi‐
37 tion variable; if threads of differing processes attempt to operate on
38 such a condition variable, the behavior is undefined. The default
39 value of the attribute is PTHREAD_PROCESS_PRIVATE.
40
41
42 Additional attributes, their default values, and the names of the asso‐
43 ciated functions to get and set those attribute values are implementa‐
44 tion-dependent.
45
47 If successful, the pthread_condattr_setpshared() function returns 0.
48 Otherwise, an error number is returned to indicate the error.
49
50
51 If successful, the pthread_condattr_getpshared() function returns 0
52 and stores the value of the process-shared attribute of attr into the
53 object referenced by the pshared parameter. Otherwise, an error number
54 is returned to indicate the error.
55
57 The pthread_condattr_getpshared() and pthread_condattr_setpshared()
58 functions may fail if:
59
60 EINVAL The value specified by attr is invalid.
61
62
63
64 The pthread_condattr_setpshared() function will fail if:
65
66 EINVAL The new value specified for the attribute is outside the
67 range of legal values for that attribute.
68
69
71 See attributes(5) for descriptions of the following attributes:
72
73
74
75
76 ┌─────────────────────────────┬─────────────────────────────┐
77 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
78 ├─────────────────────────────┼─────────────────────────────┤
79 │Interface Stability │Standard │
80 ├─────────────────────────────┼─────────────────────────────┤
81 │MT-Level │MT-Safe │
82 └─────────────────────────────┴─────────────────────────────┘
83
85 pthread_condattr_init(3C), pthread_create(3C), pthread_mutex_init(3C),
86 pthread_cond_init(3C), attributes(5), standards(5)
87
88
89
90SunOS 5.11 23 Mar 2005 pthread_condattr_getpshared(3C)