1pthread_spin_destroy(3C) Standard C Library Functions pthread_spin_destroy(3C)
2
3
4

NAME

6       pthread_spin_destroy,  pthread_spin_init - destroy or initialize a spin
7       lock object
8

SYNOPSIS

10       cc -mt [ flag... ] file... [ library... ]
11       #include <pthread.h>
12
13       int pthread_spin_destroy(pthread_spinlock_t *lock);
14
15
16       int pthread_spin_init(pthread_spinlock_t *lock, int pshared);
17
18

DESCRIPTION

20       The pthread_spin_destroy() function destroys the spin  lock  referenced
21       by  lock and release any resources used by the lock. The effect of sub‐
22       sequent use of the lock is undefined until the lock is reinitialized by
23       another  call  to  pthread_spin_init().  The  results  are undefined if
24       pthread_spin_destroy() is called when a thread holds the  lock,  or  if
25       this function is called with an uninitialized thread spin lock.
26
27
28       The  pthread_spin_init()  function  allocates any resources required to
29       use the spin lock referenced by lock and  initialize  the  lock  to  an
30       unlocked state.
31
32
33       If  the  Thread  Process-Shared Synchronization option is supported and
34       the value of pshared is PTHREAD_PROCESS_SHARED, the spin  lock  can  be
35       operated  upon  by  any  thread that has access to the memory where the
36       spin lock is allocated, even if it  is  allocated  in  memory  that  is
37       shared by multiple processes.
38
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 can only be operated upon by threads cre‐
43       ated 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
48       The results are undefined if pthread_spin_init() is  called  specifying
49       an  already  initialized spin lock. The results are undefined if a spin
50       lock is used without first being initialized.
51
52
53       If the pthread_spin_init() function fails, the lock is not  initialized
54       and the contents of lock are undefined.
55
56
57       Only  the object referenced by lock can be used for performing synchro‐
58       nization.
59
60
61       The  result  of  referring  to  copies  of  that  object  in  calls  to
62       pthread_spin_destroy(),     pthread_spin_lock(3C),    pthread_spin_try‐
63       lock(3C), or pthread_spin_unlock(3C) is undefined.
64

RETURN VALUES

66       Upon successful completion, these functions returns  0.  Otherwise,  an
67       error number is returned to indicate the error.
68

ERRORS

70       The pthread_spin_init() function will fail if:
71
72       EAGAIN    The  system  lacks  the  necessary  resources  to  initialize
73                 another spin lock.
74
75
76
77       These functions may fail if:
78
79       EBUSY     The system has detected an attempt to initialize or destroy a
80                 spin  lock  while it is in use (for example, while being used
81                 in a pthread_spin_lock() call) by another thread.
82
83
84       EINVAL    The value specified by lock is invalid.
85
86

ATTRIBUTES

88       See attributes(5) for descriptions of the following attributes:
89
90
91
92
93       ┌─────────────────────────────┬─────────────────────────────┐
94       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
95       ├─────────────────────────────┼─────────────────────────────┤
96       │Interface Stability          │Standard                     │
97       ├─────────────────────────────┼─────────────────────────────┤
98       │MT-Level                     │MT-Safe                      │
99       └─────────────────────────────┴─────────────────────────────┘
100

SEE ALSO

102       pthread_spin_lock(3C),  pthread_spin_unlock(3C),  attributes(5),  stan‐
103       dards(5)
104
105
106
107SunOS 5.11                        30 Jan 2004         pthread_spin_destroy(3C)
Impressum