1PTHREAD_RWLOCK_DESTROY(3P) POSIX Programmer's ManualPTHREAD_RWLOCK_DESTROY(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_destroy, pthread_rwlock_init - destroy and initialize  a
13       read-write lock object
14

SYNOPSIS

16       #include <pthread.h>
17
18       int pthread_rwlock_destroy(pthread_rwlock_t *rwlock);
19       int pthread_rwlock_init(pthread_rwlock_t *restrict rwlock,
20              const pthread_rwlockattr_t *restrict attr);
21
22

DESCRIPTION

24       The pthread_rwlock_destroy() function shall destroy the read-write lock
25       object referenced by rwlock and release any resources used by the lock.
26       The effect of subsequent use of the lock is undefined until the lock is
27       reinitialized by another call to pthread_rwlock_init(). An  implementa‐
28       tion may cause pthread_rwlock_destroy() to set the object referenced by
29       rwlock   to   an   invalid   value.   Results    are    undefined    if
30       pthread_rwlock_destroy()  is  called  when  any  thread  holds  rwlock.
31       Attempting to destroy an uninitialized read-write lock results in unde‐
32       fined behavior.
33
34       The   pthread_rwlock_init()   function  shall  allocate  any  resources
35       required to use the read-write lock referenced by rwlock  and  initial‐
36       izes  the lock to an unlocked state with attributes referenced by attr.
37       If attr is NULL, the default read-write lock attributes shall be  used;
38       the  effect  is the same as passing the address of a default read-write
39       lock attributes object. Once initialized, the lock can be used any num‐
40       ber  of  times  without  being  reinitialized. Results are undefined if
41       pthread_rwlock_init() is called specifying an already initialized read-
42       write  lock. Results are undefined if a read-write lock is used without
43       first being initialized.
44
45       If the pthread_rwlock_init() function fails, rwlock shall not  be  ini‐
46       tialized and the contents of rwlock are undefined.
47
48       Only  the  object  referenced by rwlock may be used for performing syn‐
49       chronization. The result of referring to copies of that object in calls
50       to          pthread_rwlock_destroy(),          pthread_rwlock_rdlock(),
51       pthread_rwlock_timedrdlock(),             pthread_rwlock_timedwrlock(),
52       pthread_rwlock_tryrdlock(),                 pthread_rwlock_trywrlock(),
53       pthread_rwlock_unlock(), or pthread_rwlock_wrlock() is undefined.
54

RETURN VALUE

56       If successful, the pthread_rwlock_destroy()  and  pthread_rwlock_init()
57       functions  shall  return  zero;  otherwise,  an  error  number shall be
58       returned to indicate the error.
59
60       The [EBUSY] and [EINVAL] error checks, if implemented, act as  if  they
61       were performed immediately at the beginning of processing for the func‐
62       tion and caused an error return prior to modifying  the  state  of  the
63       read-write lock specified by rwlock.
64

ERRORS

66       The pthread_rwlock_destroy() function may fail if:
67
68       EBUSY  The implementation has detected an attempt to destroy the object
69              referenced by rwlock while it is locked.
70
71       EINVAL The value specified by rwlock is invalid.
72
73
74       The pthread_rwlock_init() function shall fail if:
75
76       EAGAIN The system lacked the necessary resources (other than memory) to
77              initialize another read-write lock.
78
79       ENOMEM Insufficient memory exists to initialize the read-write lock.
80
81       EPERM  The caller does not have the privilege to perform the operation.
82
83
84       The pthread_rwlock_init() function may fail if:
85
86       EBUSY  The  implementation  has detected an attempt to reinitialize the
87              object referenced by rwlock, a previously  initialized  but  not
88              yet destroyed read-write lock.
89
90       EINVAL The value specified by attr is invalid.
91
92
93       These functions shall not return an error code of [EINTR].
94
95       The following sections are informative.
96

EXAMPLES

98       None.
99

APPLICATION USAGE

101       Applications  using  these and related read-write lock functions may be
102       subject to priority inversion, as discussed  in  the  Base  Definitions
103       volume of IEEE Std 1003.1-2001, Section 3.285, Priority Inversion.
104

RATIONALE

106       None.
107

FUTURE DIRECTIONS

109       None.
110

SEE ALSO

112       pthread_rwlock_rdlock(),                  pthread_rwlock_timedrdlock(),
113       pthread_rwlock_timedwrlock(),               pthread_rwlock_tryrdlock(),
114       pthread_rwlock_trywrlock(),                    pthread_rwlock_unlock(),
115       pthread_rwlock_wrlock(),    the    Base    Definitions    volume     of
116       IEEE Std 1003.1-2001, <pthread.h>
117
119       Portions  of  this text are reprinted and reproduced in electronic form
120       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
121       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
122       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
123       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
124       event of any discrepancy between this version and the original IEEE and
125       The  Open Group Standard, the original IEEE and The Open Group Standard
126       is the referee document. The original Standard can be  obtained  online
127       at http://www.opengroup.org/unix/online.html .
128
129
130
131IEEE/The Open Group                  2003           PTHREAD_RWLOCK_DESTROY(3P)
Impressum