1PTHREAD_RWLOCK_UNLOCK(P) POSIX Programmer's Manual PTHREAD_RWLOCK_UNLOCK(P)
2
3
4
6 pthread_rwlock_unlock - unlock a read-write lock object
7
9 #include <pthread.h>
10
11 int pthread_rwlock_unlock(pthread_rwlock_t *rwlock);
12
13
15 The pthread_rwlock_unlock() function shall release a lock held on the
16 read-write lock object referenced by rwlock. Results are undefined if
17 the read-write lock rwlock is not held by the calling thread.
18
19 If this function is called to release a read lock from the read-write
20 lock object and there are other read locks currently held on this read-
21 write lock object, the read-write lock object remains in the read
22 locked state. If this function releases the last read lock for this
23 read-write lock object, the read-write lock object shall be put in the
24 unlocked state with no owners.
25
26 If this function is called to release a write lock for this read-write
27 lock object, the read-write lock object shall be put in the unlocked
28 state.
29
30 If there are threads blocked on the lock when it becomes available, the
31 scheduling policy shall determine which thread(s) shall acquire the
32 lock. If the Thread Execution Scheduling option is supported, when
33 threads executing with the scheduling policies SCHED_FIFO, SCHED_RR, or
34 SCHED_SPORADIC are waiting on the lock, they shall acquire the lock in
35 priority order when the lock becomes available. For equal priority
36 threads, write locks shall take precedence over read locks. If the
37 Thread Execution Scheduling option is not supported, it is implementa‐
38 tion-defined whether write locks take precedence over read locks.
39
40 Results are undefined if any of these functions are called with an
41 uninitialized read-write lock.
42
44 If successful, the pthread_rwlock_unlock() function shall return zero;
45 otherwise, an error number shall be returned to indicate the error.
46
48 The pthread_rwlock_unlock() function may fail if:
49
50 EINVAL The value specified by rwlock does not refer to an initialized
51 read-write lock object.
52
53 EPERM The current thread does not hold a lock on the read-write lock.
54
55
56 The pthread_rwlock_unlock() function shall not return an error code of
57 [EINTR].
58
59 The following sections are informative.
60
62 None.
63
65 None.
66
68 None.
69
71 None.
72
74 pthread_rwlock_destroy() , pthread_rwlock_rdlock() ,
75 pthread_rwlock_timedrdlock() , pthread_rwlock_timedwrlock() ,
76 pthread_rwlock_tryrdlock() , pthread_rwlock_trywrlock() ,
77 pthread_rwlock_wrlock() , the Base Definitions volume of
78 IEEE Std 1003.1-2001, <pthread.h>
79
81 Portions of this text are reprinted and reproduced in electronic form
82 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
83 -- Portable Operating System Interface (POSIX), The Open Group Base
84 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
85 Electrical and Electronics Engineers, Inc and The Open Group. In the
86 event of any discrepancy between this version and the original IEEE and
87 The Open Group Standard, the original IEEE and The Open Group Standard
88 is the referee document. The original Standard can be obtained online
89 at http://www.opengroup.org/unix/online.html .
90
91
92
93IEEE/The Open Group 2003 PTHREAD_RWLOCK_UNLOCK(P)