1pthread_rwlock_unlock(3C)Standard C Library Functionspthread_rwlock_unlock(3C)
2
3
4
6 pthread_rwlock_unlock - unlock read-write lock object
7
9 cc -mt [ flag... ] file... -lpthread [ library... ]
10 #include <pthread.h>
11
12 int pthread_rwlock_unlock(pthread_rwlock_t *rwlock);
13
14
16 The pthread_rwlock_unlock() function is called to release a lock held
17 on the read-write lock object referenced by rwlock. Results are unde‐
18 fined if the read-write lock rwlock is not held by the calling thread.
19
20
21 If this function is called to release a read lock from the read-write
22 lock object and there are other read locks currently held on this read-
23 write lock object, the read-write lock object remains in the read
24 locked state. If this function releases the calling thread's last read
25 lock on this read-write lock object, then the calling thread is no
26 longer one of the owners of the object. If this function releases the
27 last read lock for this read-write lock object, the read-write lock
28 object will be put in the unlocked state with no owners.
29
30
31 If this function is called to release a write lock for this read-write
32 lock object, the read-write lock object will be put in the unlocked
33 state with no owners.
34
35
36 If the call to the pthread_rwlock_unlock() function results in the
37 read-write lock object becoming unlocked and there are multiple threads
38 waiting to acquire the read-write lock object for writing, the schedul‐
39 ing policy is used to determine which thread acquires the read-write
40 lock object for writing. If there are multiple threads waiting to
41 acquire the read-write lock object for reading, the scheduling policy
42 is used to determine the order in which the waiting threads acquire the
43 read-write lock object for reading. If there are multiple threads
44 blocked on rwlock for both read locks and write locks, it is unspeci‐
45 fied whether the readers acquire the lock first or whether a writer
46 acquires the lock first.
47
48
49 Results are undefined if any of these functions are called with an
50 uninitialized read-write lock.
51
53 If successful, the pthread_rwlock_unlock() function returns 0. Other‐
54 wise, an error number is returned to indicate the error.
55
57 See attributes(5) for descriptions of the following attributes:
58
59
60
61
62 ┌─────────────────────────────┬─────────────────────────────┐
63 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
64 ├─────────────────────────────┼─────────────────────────────┤
65 │Interface Stability │Standard │
66 ├─────────────────────────────┼─────────────────────────────┤
67 │MT-Level │MT-Safe │
68 └─────────────────────────────┴─────────────────────────────┘
69
71 pthread_rwlock_init(3C), pthread_rwlock_rdlock(3C),
72 pthread_rwlock_wrlock(3C), pthread_rwlockattr_init(3C), attributes(5),
73 standards(5)
74
75
76
77SunOS 5.11 23 Mar 2005 pthread_rwlock_unlock(3C)