summaryrefslogtreecommitdiffstats
path: root/man3/pthread_spin_init.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/pthread_spin_init.3')
-rw-r--r--man3/pthread_spin_init.324
1 files changed, 12 insertions, 12 deletions
diff --git a/man3/pthread_spin_init.3 b/man3/pthread_spin_init.3
index 87ad2e8..57ccb88 100644
--- a/man3/pthread_spin_init.3
+++ b/man3/pthread_spin_init.3
@@ -2,7 +2,7 @@
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
-.TH pthread_spin_init 3 2023-03-30 "Linux man-pages 6.05.01"
+.TH pthread_spin_init 3 2023-10-31 "Linux man-pages 6.7"
.SH NAME
pthread_spin_init, pthread_spin_destroy \- initialize or destroy a spin lock
.SH LIBRARY
@@ -11,16 +11,16 @@ POSIX threads library
.SH SYNOPSIS
.nf
.B #include <pthread.h>
-.PP
+.P
.BI "int pthread_spin_init(pthread_spinlock_t *" lock ", int " pshared ");"
.BI "int pthread_spin_destroy(pthread_spinlock_t *" lock ");"
.fi
-.PP
+.P
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
-.PP
+.P
.BR pthread_spin_init (),
.BR pthread_spin_destroy ():
.nf
@@ -33,7 +33,7 @@ instead of spin locks.
Spin locks are primarily useful in conjunction with real-time
scheduling policies.
See NOTES.
-.PP
+.P
The
.BR pthread_spin_init ()
function allocates any resources required for the use of
@@ -56,12 +56,12 @@ The spin lock may be operated on by any thread in any process that
has access to the memory containing the lock
(i.e., the lock may be in a shared memory object that is
shared among multiple processes).
-.PP
+.P
Calling
.BR pthread_spin_init ()
on a spin lock that has already been initialized results
in undefined behavior.
-.PP
+.P
The
.BR pthread_spin_destroy ()
function destroys a previously initialized spin lock,
@@ -69,13 +69,13 @@ freeing any resources that were allocated for that lock.
Destroying a spin lock that has not been previously been initialized
or destroying a spin lock while another thread holds the lock
results in undefined behavior.
-.PP
+.P
Once a spin lock has been destroyed,
performing any operation on the lock other than
once more initializing it with
.BR pthread_spin_init ()
results in undefined behavior.
-.PP
+.P
The result of performing operations such as
.BR pthread_spin_lock (3),
.BR pthread_spin_unlock (3),
@@ -108,7 +108,7 @@ POSIX.1-2008.
.SH HISTORY
glibc 2.2.
POSIX.1-2001.
-.PP
+.P
Support for process-shared spin locks is a POSIX option.
The option is supported in the glibc implementation.
.SH NOTES
@@ -124,10 +124,10 @@ The problem is that if a thread operating under such a policy
is scheduled off the CPU while it holds a spin lock,
then other threads will waste time spinning on the lock
until the lock holder is once more rescheduled and releases the lock.
-.PP
+.P
If threads create a deadlock situation while employing spin locks,
those threads will spin forever consuming CPU time.
-.PP
+.P
User-space spin locks are
.I not
applicable as a general locking solution.