1pthread_rwlockattr_getpshaSrteadn(d3aCr)d C Library Fupntchtrieoands_rwlockattr_getpshared(3C)
2
3
4
6 pthread_rwlockattr_getpshared, pthread_rwlockattr_setpshared - get or
7 set process-shared attribute of read-write lock attributes object
8
10 cc -mt [ flag... ] file... -lpthread [ library... ]
11 #include <pthread.h>
12
13 int pthread_rwlockattr_getpshared(
14 const pthread_rwlockattr_t *restrict attr,
15 int *restrict pshared);
16
17
18 int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *attr,
19 int pshared);
20
21
23 The process-shared attribute is set to PTHREAD_PROCESS_SHARED to per‐
24 mit a read-write lock to be operated upon by any thread that has access
25 to the memory where the read-write lock is allocated, even if the
26 read-write lock is allocated in memory that is shared by multiple pro‐
27 cesses. If the process-shared attribute is PTHREAD_PROCESS_PRIVATE,
28 the read-write lock will only be operated upon by threads created
29 within the same process as the thread that initialised the read-write
30 lock; if threads of differing processes attempt to operate on such a
31 read-write lock, the behaviour is undefined. The default value of the
32 process-shared attribute is PTHREAD_PROCESS_PRIVATE.
33
34
35 The pthread_rwlockattr_getpshared() function obtains the value of the
36 process-shared attribute from the initialised attributes object refer‐
37 enced by attr. The pthread_rwlockattr_setpshared() function is used to
38 set the process-shared attribute in an initialised attributes object
39 referenced by attr.
40
42 If successful, the pthread_rwlockattr_setpshared() function returns
43 0. Otherwise, an error number is returned to indicate the error.
44
45
46 Upon successful completion, the pthread_rwlockattr_getpshared()
47 returns 0 and stores the value of the process-shared attribute of attr
48 into the object referenced by the pshared parameter. Otherwise an error
49 number is returned to indicate the error.
50
52 The pthread_rwlockattr_getpshared() and pthread_rwlockattr_setpshared()
53 functions will fail if:
54
55 EINVAL The value specified by attr or pshared is invalid.
56
57
59 See attributes(5) for descriptions of the following attributes:
60
61
62
63
64 ┌─────────────────────────────┬─────────────────────────────┐
65 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
66 ├─────────────────────────────┼─────────────────────────────┤
67 │Interface Stability │Standard │
68 ├─────────────────────────────┼─────────────────────────────┤
69 │MT-Level │MT-Safe │
70 └─────────────────────────────┴─────────────────────────────┘
71
73 pthread_rwlock_init(3C), pthread_rwlock_rdlock(3C),
74 pthread_rwlock_unlock(3C), pthread_rwlock_wrlock(3C), pthread_rwlock‐
75 attr_init(3C), attributes(5), standards(5)
76
77
78
79SunOS 5.11 23 Mar 2005pthread_rwlockattr_getpshared(3C)