1PTHREAD_RWLOCK_TIMEDRDLOCK(3PPO)SIX Programmer's ManPuTaHlREAD_RWLOCK_TIMEDRDLOCK(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_timedrdlock - lock a read-write lock for reading
13

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

54       The pthread_rwlock_timedrdlock() function shall return zero if the lock
55       for  reading  on  the  read-write  lock  object referenced by rwlock is
56       acquired. Otherwise, an error number shall be returned to indicate  the
57       error.
58

ERRORS

60       The pthread_rwlock_timedrdlock() function shall fail if:
61
62       ETIMEDOUT
63              The  lock  could  not  be  acquired before the specified timeout
64              expired.
65
66
67       The pthread_rwlock_timedrdlock() function may fail if:
68
69       EAGAIN The read lock could not be acquired because the  maximum  number
70              of read locks for lock would be exceeded.
71
72       EDEADLK
73              The calling thread already holds a write lock on rwlock.
74
75       EINVAL The  value  specified by rwlock does not refer to an initialized
76              read-write lock object, or the abs_timeout nanosecond  value  is
77              less than zero or greater than or equal to 1000 million.
78
79
80       This function shall not return an error code of [EINTR].
81
82       The following sections are informative.
83

EXAMPLES

85       None.
86

APPLICATION USAGE

88       Applications  using this function may be subject to priority inversion,
89       as discussed in the Base Definitions  volume  of  IEEE Std 1003.1-2001,
90       Section 3.285, Priority Inversion.
91
92       The  pthread_rwlock_timedrdlock()  function  is part of the Threads and
93       Timeouts options and need not be provided on all implementations.
94

RATIONALE

96       None.
97

FUTURE DIRECTIONS

99       None.
100

SEE ALSO

102       pthread_rwlock_destroy(),                      pthread_rwlock_rdlock(),
103       pthread_rwlock_timedwrlock(),               pthread_rwlock_tryrdlock(),
104       pthread_rwlock_trywrlock(),                    pthread_rwlock_unlock(),
105       pthread_rwlock_wrlock(),     the    Base    Definitions    volume    of
106       IEEE Std 1003.1-2001, <pthread.h>, <time.h>
107
109       Portions of this text are reprinted and reproduced in  electronic  form
110       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
111       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
112       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
113       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
114       event of any discrepancy between this version and the original IEEE and
115       The Open Group Standard, the original IEEE and The Open Group  Standard
116       is  the  referee document. The original Standard can be obtained online
117       at http://www.opengroup.org/unix/online.html .
118
119
120
121IEEE/The Open Group                  2003       PTHREAD_RWLOCK_TIMEDRDLOCK(3P)
Impressum