]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3p/pthread_rwlock_timedwrlock.3p
Import of man-pages 1.70
[thirdparty/man-pages.git] / man3p / pthread_rwlock_timedwrlock.3p
1 .\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
2 .TH "PTHREAD_RWLOCK_TIMEDWRLOCK" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
3 .\" pthread_rwlock_timedwrlock
4 .SH NAME
5 pthread_rwlock_timedwrlock \- lock a read-write lock for writing
6 .SH SYNOPSIS
7 .LP
8 \fB#include <pthread.h>
9 .br
10 #include <time.h>
11 .br
12 .sp
13 int pthread_rwlock_timedwrlock(pthread_rwlock_t *restrict\fP \fIrwlock\fP\fB,
14 .br
15 \ \ \ \ \ \ const struct timespec *restrict\fP \fIabs_timeout\fP\fB);
16 \fP
17 \fB
18 .br
19 \fP
20 .SH DESCRIPTION
21 .LP
22 The \fIpthread_rwlock_timedwrlock\fP() function shall apply a write
23 lock to the read-write lock referenced by \fIrwlock\fP as
24 in the \fIpthread_rwlock_wrlock\fP() function. However, if the lock
25 cannot
26 be acquired without waiting for other threads to unlock the lock,
27 this wait shall be terminated when the specified timeout expires.
28 The timeout shall expire when the absolute time specified by \fIabs_timeout\fP
29 passes, as measured by the clock on which timeouts
30 are based (that is, when the value of that clock equals or exceeds
31 \fIabs_timeout\fP), or if the absolute time specified by
32 \fIabs_timeout\fP has already been passed at the time of the call.
33 .LP
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
36 timeout shall be based on the system clock as returned by the
37 \fItime\fP() function. The resolution of the timeout shall be the
38 resolution of the clock on
39 which it is based. The \fBtimespec\fP data type is defined in the
40 \fI<time.h>\fP
41 header. Under no circumstances shall the function fail with a timeout
42 if the lock can be acquired immediately. The validity of the
43 \fIabs_timeout\fP parameter need not be checked if the lock can be
44 immediately acquired.
45 .LP
46 If a signal that causes a signal handler to be executed is delivered
47 to a thread blocked on a read-write lock via a call to
48 \fIpthread_rwlock_timedwrlock\fP(), upon return from the signal handler
49 the thread shall resume waiting for the lock as if it was
50 not interrupted.
51 .LP
52 The calling thread may deadlock if at the time the call is made it
53 holds the read-write lock. The results are undefined if this
54 function is called with an uninitialized read-write lock.
55 .SH RETURN VALUE
56 .LP
57 The \fIpthread_rwlock_timedwrlock\fP() function shall return zero
58 if the lock for writing on the read-write lock object
59 referenced by \fIrwlock\fP is acquired. Otherwise, an error number
60 shall be returned to indicate the error.
61 .SH ERRORS
62 .LP
63 The \fIpthread_rwlock_timedwrlock\fP() function shall fail if:
64 .TP 7
65 .B ETIMEDOUT
66 The lock could not be acquired before the specified timeout expired.
67 .sp
68 .LP
69 The \fIpthread_rwlock_timedwrlock\fP() function may fail if:
70 .TP 7
71 .B EDEADLK
72 The calling thread already holds the \fIrwlock\fP.
73 .TP 7
74 .B EINVAL
75 The value specified by rwlock does not refer to an initialized read-write
76 lock object, or the \fIabs_timeout\fP nanosecond
77 value is less than zero or greater than or equal to 1000 million.
78 .sp
79 .LP
80 This function shall not return an error code of [EINTR].
81 .LP
82 \fIThe following sections are informative.\fP
83 .SH EXAMPLES
84 .LP
85 None.
86 .SH APPLICATION USAGE
87 .LP
88 Applications using this function may be subject to priority inversion,
89 as discussed in the Base Definitions volume of
90 IEEE\ Std\ 1003.1-2001, Section 3.285, Priority Inversion.
91 .LP
92 The \fIpthread_rwlock_timedwrlock\fP() function is part of the Threads
93 and Timeouts options and need not be provided on all
94 implementations.
95 .SH RATIONALE
96 .LP
97 None.
98 .SH FUTURE DIRECTIONS
99 .LP
100 None.
101 .SH SEE ALSO
102 .LP
103 \fIpthread_rwlock_destroy\fP() , \fIpthread_rwlock_rdlock\fP() , \fIpthread_rwlock_timedrdlock\fP()
104 , \fIpthread_rwlock_tryrdlock\fP() , \fIpthread_rwlock_trywrlock\fP()
105 , \fIpthread_rwlock_unlock\fP() , \fIpthread_rwlock_wrlock\fP() ,
106 the Base Definitions volume of IEEE\ Std\ 1003.1-2001, \fI<pthread.h>\fP,
107 \fI<time.h>\fP
108 .SH COPYRIGHT
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 at
117 http://www.opengroup.org/unix/online.html .