1
by Francesco Paolo Lovergine
rules: linking manpages-posix not manpages. |
1 |
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved |
2
by Francesco Paolo Lovergine
* Alligned to linux main manpages edition. |
2 |
.TH "PTHREAD_RWLOCK_DESTROY" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual" |
1
by Francesco Paolo Lovergine
rules: linking manpages-posix not manpages. |
3 |
.\" pthread_rwlock_destroy |
4 |
.SH NAME |
|
5 |
pthread_rwlock_destroy, pthread_rwlock_init \- destroy and initialize
|
|
6 |
a read\-write lock object
|
|
7 |
.SH SYNOPSIS |
|
8 |
.LP
|
|
9 |
\fB#include <pthread.h>
|
|
10 |
.br
|
|
11 |
.sp
|
|
12 |
int pthread_rwlock_destroy(pthread_rwlock_t *\fP\fIrwlock\fP\fB); |
|
13 |
.br
|
|
14 |
int pthread_rwlock_init(pthread_rwlock_t *restrict\fP \fIrwlock\fP\fB, |
|
15 |
.br
|
|
16 |
\ \ \ \ \ \ const pthread_rwlockattr_t *restrict\fP \fIattr\fP\fB); |
|
17 |
\fP
|
|
18 |
\fB
|
|
19 |
.br
|
|
20 |
\fP
|
|
21 |
.SH DESCRIPTION |
|
22 |
.LP
|
|
23 |
The \fIpthread_rwlock_destroy\fP() function shall destroy the read-write |
|
24 |
lock object referenced by \fIrwlock\fP and release |
|
25 |
any resources used by the lock. The effect of subsequent use of the |
|
26 |
lock is undefined until the lock is reinitialized by another |
|
27 |
call to \fIpthread_rwlock_init\fP(). An implementation may cause \fIpthread_rwlock_destroy\fP() |
|
28 |
to set the object referenced by |
|
29 |
\fIrwlock\fP to an invalid value. Results are undefined if \fIpthread_rwlock_destroy\fP() |
|
30 |
is called when any thread holds |
|
31 |
\fIrwlock\fP. Attempting to destroy an uninitialized read-write lock |
|
32 |
results in undefined behavior. |
|
33 |
.LP
|
|
34 |
The \fIpthread_rwlock_init\fP() function shall allocate any resources |
|
35 |
required to use the read-write lock referenced by |
|
36 |
\fIrwlock\fP and initializes the lock to an unlocked state with attributes |
|
37 |
referenced by \fIattr\fP. If \fIattr\fP is NULL, the |
|
38 |
default read-write lock attributes shall be used; the effect is the |
|
39 |
same as passing the address of a default read-write lock |
|
40 |
attributes object. Once initialized, the lock can be used any number |
|
41 |
of times without being reinitialized. Results are undefined if |
|
42 |
\fIpthread_rwlock_init\fP() is called specifying an already initialized |
|
43 |
read-write lock. Results are undefined if a read-write |
|
44 |
lock is used without first being initialized. |
|
45 |
.LP
|
|
46 |
If the \fIpthread_rwlock_init\fP() function fails, \fIrwlock\fP shall |
|
47 |
not be initialized and the contents of \fIrwlock\fP are |
|
48 |
undefined. |
|
49 |
.LP
|
|
50 |
Only the object referenced by \fIrwlock\fP may be used for performing |
|
51 |
synchronization. The result of referring to copies of |
|
52 |
that object in calls to \fIpthread_rwlock_destroy\fP(), \fIpthread_rwlock_rdlock\fP(), |
|
53 |
\fIpthread_rwlock_timedrdlock\fP(), \fIpthread_rwlock_timedwrlock\fP(), |
|
54 |
\fIpthread_rwlock_tryrdlock\fP(), \fIpthread_rwlock_trywrlock\fP(), |
|
55 |
\fIpthread_rwlock_unlock\fP(), or \fIpthread_rwlock_wrlock\fP() is |
|
56 |
undefined. |
|
57 |
.SH RETURN VALUE |
|
58 |
.LP
|
|
59 |
If successful, the \fIpthread_rwlock_destroy\fP() and \fIpthread_rwlock_init\fP() |
|
60 |
functions shall return zero; otherwise, an |
|
61 |
error number shall be returned to indicate the error. |
|
62 |
.LP
|
|
63 |
The [EBUSY] and [EINVAL] error checks, if implemented, act as if they |
|
64 |
were performed immediately at the beginning of processing |
|
65 |
for the function and caused an error return prior to modifying the |
|
66 |
state of the read-write lock specified by \fIrwlock\fP. |
|
67 |
.SH ERRORS |
|
68 |
.LP
|
|
69 |
The \fIpthread_rwlock_destroy\fP() function may fail if: |
|
70 |
.TP 7 |
|
71 |
.B EBUSY |
|
72 |
The implementation has detected an attempt to destroy the object referenced |
|
73 |
by \fIrwlock\fP while it is locked. |
|
74 |
.TP 7 |
|
75 |
.B EINVAL |
|
76 |
The value specified by \fIrwlock\fP is invalid. |
|
77 |
.sp
|
|
78 |
.LP
|
|
79 |
The \fIpthread_rwlock_init\fP() function shall fail if: |
|
80 |
.TP 7 |
|
81 |
.B EAGAIN |
|
82 |
The system lacked the necessary resources (other than memory) to initialize |
|
83 |
another read-write lock. |
|
84 |
.TP 7 |
|
85 |
.B ENOMEM |
|
86 |
Insufficient memory exists to initialize the read-write lock. |
|
87 |
.TP 7 |
|
88 |
.B EPERM |
|
89 |
The caller does not have the privilege to perform the operation. |
|
90 |
.sp
|
|
91 |
.LP
|
|
92 |
The \fIpthread_rwlock_init\fP() function may fail if: |
|
93 |
.TP 7 |
|
94 |
.B EBUSY |
|
95 |
The implementation has detected an attempt to reinitialize the object |
|
96 |
referenced by \fIrwlock\fP, a previously initialized but |
|
97 |
not yet destroyed read-write lock. |
|
98 |
.TP 7 |
|
99 |
.B EINVAL |
|
100 |
The value specified by \fIattr\fP is invalid. |
|
101 |
.sp
|
|
102 |
.LP
|
|
103 |
These functions shall not return an error code of [EINTR]. |
|
104 |
.LP
|
|
105 |
\fIThe following sections are informative.\fP |
|
106 |
.SH EXAMPLES |
|
107 |
.LP
|
|
108 |
None. |
|
109 |
.SH APPLICATION USAGE |
|
110 |
.LP
|
|
111 |
Applications using these and related read-write lock functions may |
|
112 |
be subject to priority inversion, as discussed in the Base |
|
113 |
Definitions volume of IEEE\ Std\ 1003.1-2001, Section 3.285, Priority |
|
114 |
Inversion. |
|
115 |
.SH RATIONALE |
|
116 |
.LP
|
|
117 |
None. |
|
118 |
.SH FUTURE DIRECTIONS |
|
119 |
.LP
|
|
120 |
None. |
|
121 |
.SH SEE ALSO |
|
122 |
.LP
|
|
123 |
\fIpthread_rwlock_rdlock\fP() , \fIpthread_rwlock_timedrdlock\fP() |
|
124 |
, \fIpthread_rwlock_timedwrlock\fP() , \fIpthread_rwlock_tryrdlock\fP() |
|
125 |
, \fIpthread_rwlock_trywrlock\fP() , \fIpthread_rwlock_unlock\fP() |
|
126 |
, \fIpthread_rwlock_wrlock\fP() , the Base Definitions volume of IEEE\ Std\ 1003.1-2001, |
|
127 |
\fI<pthread.h>\fP |
|
128 |
.SH COPYRIGHT |
|
129 |
Portions of this text are reprinted and reproduced in electronic form |
|
130 |
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology |
|
131 |
-- Portable Operating System Interface (POSIX), The Open Group Base |
|
132 |
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of |
|
133 |
Electrical and Electronics Engineers, Inc and The Open Group. In the |
|
134 |
event of any discrepancy between this version and the original IEEE and |
|
135 |
The Open Group Standard, the original IEEE and The Open Group Standard |
|
136 |
is the referee document. The original Standard can be obtained online at |
|
137 |
http://www.opengroup.org/unix/online.html . |