1PTHREAD_RWLOCK_TIMEDRDLOCK(PP)OSIX Programmer's ManuPaTlHREAD_RWLOCK_TIMEDRDLOCK(P)
2
3
4

NAME

6       pthread_rwlock_timedrdlock - lock a read-write lock for reading
7

SYNOPSIS

9       #include <pthread.h>
10       #include <time.h>
11
12       int pthread_rwlock_timedrdlock(pthread_rwlock_t *restrict rwlock,
13              const struct timespec *restrict abs_timeout);
14
15

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

EXAMPLES

79       None.
80

APPLICATION USAGE

82       Applications using this function may be subject to priority  inversion,
83       as  discussed  in  the Base Definitions volume of IEEE Std 1003.1-2001,
84       Section 3.285, Priority Inversion.
85
86       The pthread_rwlock_timedrdlock() function is part of  the  Threads  and
87       Timeouts options and need not be provided on all implementations.
88

RATIONALE

90       None.
91

FUTURE DIRECTIONS

93       None.
94

SEE ALSO

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