]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/pthread_spin_init.3
ld.so.8: srcfix
[thirdparty/man-pages.git] / man3 / pthread_spin_init.3
index 773c6aa8639695a4213d256257d78412a32a1d85..ce47d428036a32fcd5fd58674f314c28457a0164 100644 (file)
@@ -29,8 +29,8 @@ pthread_spin_init, pthread_spin_destroy \- initialize or destroy a spin lock
 .nf
 .B #include <pthread.h>
 .PP
-.BI "int pthread_spin_init(pthread_spinlock_t *" lock " int " pshared ");"
-.BI "int pthread_spin_destroy(pthread_spinlock_t *" cock ");"
+.BI "int pthread_spin_init(pthread_spinlock_t *" lock ", int " pshared ");"
+.BI "int pthread_spin_destroy(pthread_spinlock_t *" lock ");"
 .fi
 .PP
 Compile and link with \fI\-pthread\fP.
@@ -146,9 +146,19 @@ 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
-.BR Warning :
-if threads create a deadlock situation while employing spin locks,
+If threads create a deadlock situation while employing spin locks,
 those threads will spin forever consuming CPU time.
+.PP
+User-space spin locks are
+.I not
+applicable as a general locking solution.
+They are, by definition,
+prone to priority inversion and unbounded spin times.
+A programmer using spin locks must be exceptionally careful not
+only in the code, but also in terms of system configuration,
+thread placement, and priority assignment.
+.\" FIXME . When PTHREAD_MUTEX_ADAPTIVE_NP is one day document
+.\" make reference to it here
 .SH SEE ALSO
 .ad l
 .nh