1PTHREAD_RWLOCK_TIMEDWRLOCK(3PPO)SIX Programmer's ManPuTaHlREAD_RWLOCK_TIMEDWRLOCK(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_timedwrlock — lock a read-write lock for writing
13

SYNOPSIS

15       #include <pthread.h>
16       #include <time.h>
17
18       int pthread_rwlock_timedwrlock(pthread_rwlock_t *restrict rwlock,
19           const struct timespec *restrict abstime);
20

DESCRIPTION

22       The pthread_rwlock_timedwrlock() function shall apply a write  lock  to
23       the    read-write    lock    referenced    by    rwlock   as   in   the
24       pthread_rwlock_wrlock()  function.  However,  if  the  lock  cannot  be
25       acquired  without  waiting  for  other threads to unlock the lock, this
26       wait shall be terminated when the specified timeout expires. The  time‐
27       out shall expire when the absolute time specified by abstime passes, as
28       measured by the clock on which timeouts are based (that  is,  when  the
29       value of that clock equals or exceeds abstime), or if the absolute time
30       specified by abstime has already been passed at the time of the call.
31
32       The timeout shall be based on the CLOCK_REALTIME clock.  The resolution
33       of the timeout shall be the resolution of the CLOCK_REALTIME clock. The
34       timespec data type is defined in the <time.h> header. Under no  circum‐
35       stances  shall  the  function  fail  with  a timeout if the lock can be
36       acquired immediately. The validity of the abstime parameter need not be
37       checked if the lock can be immediately acquired.
38
39       If a signal that causes a signal handler to be executed is delivered to
40       a   thread   blocked   on   a   read-write   lock   via   a   call   to
41       pthread_rwlock_timedwrlock(),  upon  return from the signal handler the
42       thread shall resume waiting for the lock as if it was not interrupted.
43
44       The calling thread may deadlock if at the time  the  call  is  made  it
45       holds  the  read-write lock. The results are undefined if this function
46       is called with an uninitialized read-write lock.
47

RETURN VALUE

49       The pthread_rwlock_timedwrlock() function shall return zero if the lock
50       for  writing  on  the  read-write  lock  object referenced by rwlock is
51       acquired. Otherwise, an error number shall be returned to indicate  the
52       error.
53

ERRORS

55       The pthread_rwlock_timedwrlock() function shall fail if:
56
57       ETIMEDOUT
58              The  lock  could  not  be  acquired before the specified timeout
59              expired.
60
61       The pthread_rwlock_timedwrlock() function may fail if:
62
63       EDEADLK
64              A deadlock condition was detected or the calling thread  already
65              holds the rwlock.
66
67       EINVAL The  abstime  nanosecond value is less than zero or greater than
68              or equal to 1000 million.
69
70       This function shall not return an error code of [EINTR].
71
72       The following sections are informative.
73

EXAMPLES

75       None.
76

APPLICATION USAGE

78       Applications using this function may be subject to priority  inversion,
79       as  discussed  in  the Base Definitions volume of POSIX.1‐2017, Section
80       3.291, Priority Inversion.
81

RATIONALE

83       If an implementation detects that the value  specified  by  the  rwlock
84       argument  to pthread_rwlock_timedwrlock() does not refer to an initial‐
85       ized read-write lock object, it is recommended that the function should
86       fail and report an [EINVAL] error.
87

FUTURE DIRECTIONS

89       None.
90

SEE ALSO

92       pthread_rwlock_destroy(), pthread_rwlock_rdlock(), pthread_rwlock_time‐
93       drdlock(), pthread_rwlock_trywrlock(), pthread_rwlock_unlock()
94
95       The Base Definitions volume of POSIX.1‐2017,  Section  3.291,  Priority
96       Inversion, Section 4.12, Memory Synchronization, <pthread.h>, <time.h>
97
99       Portions  of  this text are reprinted and reproduced in electronic form
100       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
101       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
102       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
103       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
104       event of any discrepancy between this version and the original IEEE and
105       The  Open Group Standard, the original IEEE and The Open Group Standard
106       is the referee document. The original Standard can be  obtained  online
107       at http://www.opengroup.org/unix/online.html .
108
109       Any  typographical  or  formatting  errors that appear in this page are
110       most likely to have been introduced during the conversion of the source
111       files  to  man page format. To report such errors, see https://www.ker
112       nel.org/doc/man-pages/reporting_bugs.html .
113
114
115
116IEEE/The Open Group                  2017       PTHREAD_RWLOCK_TIMEDWRLOCK(3P)
Impressum