1PTHREAD_SPIN_DESTROY(3P)   POSIX Programmer's Manual  PTHREAD_SPIN_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
11

NAME

13       pthread_spin_destroy, pthread_spin_init — destroy or initialize a  spin
14       lock object
15

SYNOPSIS

17       #include <pthread.h>
18
19       int pthread_spin_destroy(pthread_spinlock_t *lock);
20       int pthread_spin_init(pthread_spinlock_t *lock, int pshared);
21

DESCRIPTION

23       The  pthread_spin_destroy() function shall destroy the spin lock refer‐
24       enced by lock and release any resources used by the lock. The effect of
25       subsequent use of the lock is undefined until the lock is reinitialized
26       by another call to pthread_spin_init().  The results are  undefined  if
27       pthread_spin_destroy()  is  called  when a thread holds the lock, or if
28       this function is called with an uninitialized thread spin lock.
29
30       The pthread_spin_init() function shall allocate any resources  required
31       to  use  the spin lock referenced by lock and initialize the lock to an
32       unlocked state.
33
34       If the Thread Process-Shared Synchronization option  is  supported  and
35       the  value  of  pshared  is  PTHREAD_PROCESS_SHARED, the implementation
36       shall permit the spin lock to be operated upon by any thread  that  has
37       access  to  the  memory where the spin lock is allocated, even if it is
38       allocated in memory that is shared by multiple processes.
39
40       If the Thread Process-Shared Synchronization option  is  supported  and
41       the  value  of  pshared is PTHREAD_PROCESS_PRIVATE, or if the option is
42       not supported, the spin lock shall only be  operated  upon  by  threads
43       created within the same process as the thread that initialized the spin
44       lock. If threads of differing processes attempt to operate  on  such  a
45       spin lock, the behavior is undefined.
46
47       The  results  are undefined if pthread_spin_init() is called specifying
48       an already initialized spin lock. The results are undefined if  a  spin
49       lock is used without first being initialized.
50
51       If  the pthread_spin_init() function fails, the lock is not initialized
52       and the contents of lock are undefined.
53
54       Only the object referenced by lock may be used for performing  synchro‐
55       nization.
56
57       The  result  of  referring  to  copies  of  that  object  in  calls  to
58       pthread_spin_destroy(), pthread_spin_lock(), pthread_spin_trylock(), or
59       pthread_spin_unlock() is undefined.
60

RETURN VALUE

62       Upon  successful  completion, these functions shall return zero; other‐
63       wise, an error number shall be returned to indicate the error.
64

ERRORS

66       The pthread_spin_init() function shall fail if:
67
68       EAGAIN The system lacks the necessary resources to  initialize  another
69              spin lock.
70
71       ENOMEM Insufficient memory exists to initialize the lock.
72
73       These functions shall not return an error code of [EINTR].
74
75       The following sections are informative.
76

EXAMPLES

78       None.
79

APPLICATION USAGE

81       None.
82

RATIONALE

84       If an implementation detects that the value specified by the lock argu‐
85       ment to pthread_spin_destroy() does not refer to  an  initialized  spin
86       lock object, it is recommended that the function should fail and report
87       an [EINVAL] error.
88
89       If an implementation detects that the value specified by the lock argu‐
90       ment  to  pthread_spin_destroy()  or  pthread_spin_init()  refers  to a
91       locked spin lock object, or detects that the  value  specified  by  the
92       lock  argument  to pthread_spin_init() refers to an already initialized
93       spin lock object, it is recommended that the function should  fail  and
94       report an [EBUSY] error.
95

FUTURE DIRECTIONS

97       None.
98

SEE ALSO

100       pthread_spin_lock(), pthread_spin_unlock()
101
102       The Base Definitions volume of POSIX.1‐2008, <pthread.h>
103
105       Portions  of  this text are reprinted and reproduced in electronic form
106       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
107       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
108       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
109       cal  and  Electronics  Engineers,  Inc  and  The  Open Group.  (This is
110       POSIX.1-2008 with the 2013 Technical Corrigendum  1  applied.)  In  the
111       event of any discrepancy between this version and the original IEEE and
112       The Open Group Standard, the original IEEE and The Open Group  Standard
113       is  the  referee document. The original Standard can be obtained online
114       at http://www.unix.org/online.html .
115
116       Any typographical or formatting errors that appear  in  this  page  are
117       most likely to have been introduced during the conversion of the source
118       files to man page format. To report such errors,  see  https://www.ker
119       nel.org/doc/man-pages/reporting_bugs.html .
120
121
122
123IEEE/The Open Group                  2013             PTHREAD_SPIN_DESTROY(3P)
Impressum