1pthread_rwlock_timedrdlockS(t3aCn)dard C Library Functpitohnrsead_rwlock_timedrdlock(3C)
2
3
4

NAME

6       pthread_rwlock_timedrdlock,  pthread_rwlock_reltimedrdlock_np  - lock a
7       read-write lock for reading
8

SYNOPSIS

10       cc -mt [ flag... ] file... [ library... ]
11       #include <pthread.h>
12       #include <time.h>
13
14       int pthread_rwlock_timedrdlock(pthread_rwlock_t *restrict rwlock,
15            const struct timespec *restrict abs_timeout);
16
17
18       int pthread_rwlock_reltimedrdlock_np(pthread_rwlock_t *restrict rwlock,
19            const struct timespec *restrict rel_timeout);
20
21

DESCRIPTION

23       The pthread_rwlock_timedrdlock() function applies a read  lock  to  the
24       read-write     lock     referenced     by     rwlock    as    in    the
25       pthread_rwlock_rdlock(3C) function. If  the  lock  cannot  be  acquired
26       without waiting for other threads to unlock the lock, this wait will be
27       terminated when the specified timeout expires. The timeout expires when
28       the  absolute  time specified by abs_timeout passes, as measured by the
29       CLOCK_REALTIME clock (that is, when the value of that clock  equals  or
30       exceeds  abs_timeout), or if the absolute time specified by abs_timeout
31       has already been passed at the time of the call.
32
33
34       The pthread_rwlock_reltimedrdlock_np() function  is  identical  to  the
35       pthread_rwlock_timedrdlock() function, except that the timeout is spec‐
36       ified as a relative time interval.  The timeout expires when  the  time
37       interval   specified   by   rel_timeout  passes,  as  measured  by  the
38       CLOCK_REALTIME clock, or if the time interval specified by  rel_timeout
39       is negative at the time of the call.
40
41
42       The  resolution  of the timeout is the resolution of the CLOCK_REALTIME
43       clock. The timespec data type is defined in the <time.h> header.  Under
44       no  circumstances  does either function fail with a timeout if the lock
45       can be acquired immediately. The validity of the timeout parameter need
46       not be checked if the lock can be immediately acquired.
47
48
49       If a signal that causes a signal handler to be executed is delivered to
50       a  thread   blocked   on   a   read-write   lock   with   a   call   to
51       pthread_rwlock_timedrdlock()   or   pthread_rwlock_reltimedrdlock_np(),
52       upon return from the signal handler the thread resumes waiting for  the
53       lock as if it was not interrupted.
54
55
56       The  calling  thread  might deadlock if at the time the call is made it
57       holds a write lock on rwlock.
58
59
60       The results are undefined if this function is called with an uninitial‐
61       ized read-write lock.
62

RETURN VALUES

64       The pthread_rwlock_timedrdlock() and pthread_rwlock_reltimedrdlock_np()
65       functions return 0 if the lock  for  reading  on  the  read-write  lock
66       object  referenced by rwlock is acquired. Otherwise, an error number is
67       returned to indicate the error.
68

ERRORS

70       The  pthread_rwlock_timedrdlock()  and  and  pthread_rwlock_reltimedrd‐
71       lock_np() functions will fail if:
72
73       ETIMEDOUT     The lock could not be acquired before the specified time‐
74                    out expired.
75
76
77
78       The pthread_rwlock_timedrdlock() and pthread_rwlock_reltimedrdlock_np()
79       functions may fail if:
80
81       EAGAIN     The read lock could not be acquired because the maximum num‐
82                  ber of read locks for lock would be exceeded.
83
84
85       EDEADLK    The calling thread already holds a write lock on rwlock.
86
87
88       EINVAL     The value specified by rwlock does not refer to an  initial‐
89                  ized read-write lock object, or the timeout nanosecond value
90                  is less than zero or greater than or equal to 1 000 million.
91
92

ATTRIBUTES

94       See attributes(5) for descriptions of the following attributes:
95
96
97
98
99       ┌─────────────────────────────┬─────────────────────────────┐
100       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
101       ├─────────────────────────────┼─────────────────────────────┤
102       │Interface Stability          │See below.                   │
103       ├─────────────────────────────┼─────────────────────────────┤
104       │MT-Level                     │MT-Safe                      │
105       └─────────────────────────────┴─────────────────────────────┘
106
107
108       The   pthread_rwlock_timedrdlock()   function    is    Standard.    The
109       pthread_rwlock_reltimedrdlock_np() is Stable.
110

SEE ALSO

112       pthread_rwlock_destroy(3C),                  pthread_rwlock_rdlock(3C),
113       pthread_rwlock_timedwrlock(3C),           pthread_rwlock_trywrlock(3C),
114       pthread_rwlock_unlock(3C),   pthread_rwlock_wrlock(3C),  attributes(5),
115       standards(5)
116
117
118
119SunOS 5.11                        30 Jan 2004   pthread_rwlock_timedrdlock(3C)
Impressum