1PTHREAD_RWLOCK_UNLOCK(3P)  POSIX Programmer's Manual PTHREAD_RWLOCK_UNLOCK(3P)
2
3
4

PROLOG

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

NAME

12       pthread_rwlock_unlock — unlock a read-write lock object
13

SYNOPSIS

15       #include <pthread.h>
16
17       int pthread_rwlock_unlock(pthread_rwlock_t *rwlock);
18

DESCRIPTION

20       The pthread_rwlock_unlock() function shall release a lock held  on  the
21       read-write  lock object referenced by rwlock.  Results are undefined if
22       the read-write lock rwlock is not held by the calling thread.
23
24       If this function is called to release a read lock from  the  read-write
25       lock object and there are other read locks currently held on this read-
26       write lock object, the read-write  lock  object  remains  in  the  read
27       locked  state.  If  this  function releases the last read lock for this
28       read-write lock object, the read-write lock object shall be put in  the
29       unlocked state with no owners.
30
31       If  this function is called to release a write lock for this read-write
32       lock object, the read-write lock object shall be put  in  the  unlocked
33       state.
34
35       If there are threads blocked on the lock when it becomes available, the
36       scheduling policy shall determine which  thread(s)  shall  acquire  the
37       lock.   If  the  Thread  Execution Scheduling option is supported, when
38       threads executing with the scheduling policies SCHED_FIFO, SCHED_RR, or
39       SCHED_SPORADIC  are waiting on the lock, they shall acquire the lock in
40       priority order when the lock  becomes  available.  For  equal  priority
41       threads,  write  locks  shall  take precedence over read locks.  If the
42       Thread Execution Scheduling option is not supported, it is  implementa‐
43       tion-defined whether write locks take precedence over read locks.
44
45       Results  are undefined if this function is called with an uninitialized
46       read-write lock.
47

RETURN VALUE

49       If successful, the pthread_rwlock_unlock() function shall return  zero;
50       otherwise, an error number shall be returned to indicate the error.
51

ERRORS

53       The  pthread_rwlock_unlock() function shall not return an error code of
54       [EINTR].
55
56       The following sections are informative.
57

EXAMPLES

59       None.
60

APPLICATION USAGE

62       None.
63

RATIONALE

65       If an implementation detects that the value  specified  by  the  rwlock
66       argument  to  pthread_rwlock_unlock()  does not refer to an initialized
67       read-write lock object, it is recommended that the function should fail
68       and report an [EINVAL] error.
69
70       If  an  implementation  detects  that the value specified by the rwlock
71       argument to pthread_rwlock_unlock() refers to a read-write lock  object
72       for  which  the  current thread does not hold a lock, it is recommended
73       that the function should fail and report an [EPERM] error.
74

FUTURE DIRECTIONS

76       None.
77

SEE ALSO

79       pthread_rwlock_destroy(), pthread_rwlock_rdlock(), pthread_rwlock_time‐
80       drdlock(), pthread_rwlock_timedwrlock(), pthread_rwlock_trywrlock()
81
82       The  Base Definitions volume of POSIX.1‐2017, Section 4.12, Memory Syn‐
83       chronization, <pthread.h>
84
86       Portions of this text are reprinted and reproduced in  electronic  form
87       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
88       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
89       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
90       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
91       event of any discrepancy between this version and the original IEEE and
92       The Open Group Standard, the original IEEE and The Open Group  Standard
93       is  the  referee document. The original Standard can be obtained online
94       at http://www.opengroup.org/unix/online.html .
95
96       Any typographical or formatting errors that appear  in  this  page  are
97       most likely to have been introduced during the conversion of the source
98       files to man page format. To report such errors,  see  https://www.ker
99       nel.org/doc/man-pages/reporting_bugs.html .
100
101
102
103IEEE/The Open Group                  2017            PTHREAD_RWLOCK_UNLOCK(3P)
Impressum