1PTHREAD_RWLOCK_UNLOCK(3P) POSIX Programmer's Manual PTHREAD_RWLOCK_UNLOCK(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
11
13 pthread_rwlock_unlock — unlock a read-write lock object
14
16 #include <pthread.h>
17
18 int pthread_rwlock_unlock(pthread_rwlock_t *rwlock);
19
21 The pthread_rwlock_unlock() function shall release a lock held on the
22 read-write lock object referenced by rwlock. Results are undefined if
23 the read-write lock rwlock is not held by the calling thread.
24
25 If this function is called to release a read lock from the read-write
26 lock object and there are other read locks currently held on this read-
27 write lock object, the read-write lock object remains in the read
28 locked state. If this function releases the last read lock for this
29 read-write lock object, the read-write lock object shall be put in the
30 unlocked state with no owners.
31
32 If this function is called to release a write lock for this read-write
33 lock object, the read-write lock object shall be put in the unlocked
34 state.
35
36 If there are threads blocked on the lock when it becomes available, the
37 scheduling policy shall determine which thread(s) shall acquire the
38 lock. If the Thread Execution Scheduling option is supported, when
39 threads executing with the scheduling policies SCHED_FIFO, SCHED_RR, or
40 SCHED_SPORADIC are waiting on the lock, they shall acquire the lock in
41 priority order when the lock becomes available. For equal priority
42 threads, write locks shall take precedence over read locks. If the
43 Thread Execution Scheduling option is not supported, it is implementa‐
44 tion-defined whether write locks take precedence over read locks.
45
46 Results are undefined if this function is called with an uninitialized
47 read-write lock.
48
50 If successful, the pthread_rwlock_unlock() function shall return zero;
51 otherwise, an error number shall be returned to indicate the error.
52
54 The pthread_rwlock_unlock() function shall not return an error code of
55 [EINTR].
56
57 The following sections are informative.
58
60 None.
61
63 None.
64
66 If an implementation detects that the value specified by the rwlock
67 argument to pthread_rwlock_unlock() does not refer to an initialized
68 read-write lock object, it is recommended that the function should fail
69 and report an [EINVAL] error.
70
71 If an implementation detects that the value specified by the rwlock
72 argument to pthread_rwlock_unlock() refers to a read-write lock object
73 for which the current thread does not hold a lock, it is recommended
74 that the function should fail and report an [EPERM] error.
75
77 None.
78
80 pthread_rwlock_destroy(), pthread_rwlock_rdlock(), pthread_rwlock_time‐
81 drdlock(), pthread_rwlock_timedwrlock(), pthread_rwlock_trywrlock()
82
83 The Base Definitions volume of POSIX.1‐2008, Section 4.11, Memory Syn‐
84 chronization, <pthread.h>
85
87 Portions of this text are reprinted and reproduced in electronic form
88 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
89 -- Portable Operating System Interface (POSIX), The Open Group Base
90 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
91 cal and Electronics Engineers, Inc and The Open Group. (This is
92 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
93 event of any discrepancy between this version and the original IEEE and
94 The Open Group Standard, the original IEEE and The Open Group Standard
95 is the referee document. The original Standard can be obtained online
96 at http://www.unix.org/online.html .
97
98 Any typographical or formatting errors that appear in this page are
99 most likely to have been introduced during the conversion of the source
100 files to man page format. To report such errors, see https://www.ker‐
101 nel.org/doc/man-pages/reporting_bugs.html .
102
103
104
105IEEE/The Open Group 2013 PTHREAD_RWLOCK_UNLOCK(3P)