add SB-EXT:*SUPPRESS-PRINT-ERRORS* modelled after *BREAK-ON-SIGNALS*
[sbcl.git] / doc / manual / threading.texinfo
index 2fbd8d8..21d2756 100644 (file)
@@ -12,16 +12,18 @@ SB-THREAD package.
 Threads are part of the default build on x86[-64] Linux only.
 
 They are also experimentally supported on: x86[-64] Darwin (Mac OS X),
-x86[-64] FreeBSD, and x86 SunOS (Solaris). On these platforms threads
-must be explicitly enabled at build-time, see @file{INSTALL} for
+x86[-64] FreeBSD, x86 SunOS (Solaris), and PPC Linux. On these platforms
+threads must be explicitly enabled at build-time, see @file{INSTALL} for
 directions.
 
 @menu
 * Threading basics::            
 * Special Variables::           
+* Atomic Operations::           
 * Mutex Support::               
 * Semaphores::                  
 * Waitqueue/condition variables::  
+* Barriers::                    
 * Sessions/Debugging::          
 * Foreign threads::             
 * Implementation (Linux x86/x86-64)::  
@@ -94,6 +96,27 @@ The last point means that
 
 prints @code{0} and not @code{1} as of 0.9.6.
 
+@node Atomic Operations
+@comment  node-name,  next,  previous,  up
+@section Atomic Operations
+
+SBCL provides a few special purpose atomic operations, particularly
+useful for implementing lockless algorithms.
+
+@include macro-sb-ext-atomic-decf.texinfo
+@include macro-sb-ext-atomic-incf.texinfo
+@include macro-sb-ext-compare-and-swap.texinfo
+
+@unnumberedsubsec CAS Protocol
+
+Our @code{compare-and-swap} is user-extensible using a protocol similar
+to @code{setf}:
+
+@include macro-sb-ext-cas.texinfo
+@include macro-sb-ext-define-cas-expander.texinfo
+@include macro-sb-ext-defcas.texinfo
+@include fun-sb-ext-get-cas-expansion.texinfo
+
 @node Mutex Support
 @comment  node-name,  next,  previous,  up
 @section Mutex Support
@@ -129,24 +152,32 @@ if you want a bounded wait.
 @include fun-sb-thread-make-mutex.texinfo
 @include fun-sb-thread-mutex-name.texinfo
 @include fun-sb-thread-mutex-value.texinfo
-@include fun-sb-thread-get-mutex.texinfo
+@include fun-sb-thread-grab-mutex.texinfo
 @include fun-sb-thread-release-mutex.texinfo
 @include macro-sb-thread-with-mutex.texinfo
 @include macro-sb-thread-with-recursive-lock.texinfo
+@include fun-sb-thread-get-mutex.texinfo
 
 @node Semaphores
 @comment  node-name,  next,  previous,  up
 @section Semaphores
 
-described here should be considered
-experimental, subject to API changes without notice.
+Semaphores are among other things useful for keeping track of a
+countable resource, eg. messages in a queue, and sleep when the
+resource is exhausted.
 
 @include struct-sb-thread-semaphore.texinfo
 @include fun-sb-thread-make-semaphore.texinfo
-@include fun-sb-thread-semaphore-count.texinfo
-@include fun-sb-thread-semaphore-name.texinfo
 @include fun-sb-thread-signal-semaphore.texinfo
 @include fun-sb-thread-wait-on-semaphore.texinfo
+@include fun-sb-thread-try-semaphore.texinfo
+@include fun-sb-thread-semaphore-count.texinfo
+@include fun-sb-thread-semaphore-name.texinfo
+
+@include struct-sb-thread-semaphore-notification.texinfo
+@include fun-sb-thread-make-semaphore-notification.texinfo
+@include fun-sb-thread-semaphore-notification-status.texinfo
+@include fun-sb-thread-clear-semaphore-notification.texinfo
 
 @node Waitqueue/condition variables
 @comment  node-name,  next,  previous,  up
@@ -232,6 +263,36 @@ it.
 @include fun-sb-thread-condition-notify.texinfo
 @include fun-sb-thread-condition-broadcast.texinfo
 
+@node Barriers
+@comment  node-name,  next,  previous,  up
+@section Barriers
+
+These are based on the Linux kernel barrier design, which is in turn
+based on the Alpha CPU memory model.  They are presently implemented for
+x86, x86-64, and PPC systems, and behave as compiler barriers on all
+other CPUs.
+
+In addition to explicit use of the @code{sb-thread:barrier} macro, the
+following functions and macros also serve as @code{:memory} barriers:
+
+@itemize
+@item
+@code{sb-ext:atomic-decf} and @code{sb-ext:atomic-incf}.
+@item
+@code{sb-ext:compare-and-swap}.
+@item
+@code{sb-thread:get-mutex}, @code{sb-thread:release-mutex},
+@code{sb-thread:with-mutex} and @code{sb-thread:with-recursive-lock}.
+@item
+@code{sb-thread:signal-semaphore}, @code{sb-thread:try-semaphore} and
+@code{sb-thread:wait-on-semaphore}.
+@item
+@code{sb-thread:condition-wait}, @code{sb-thread:condition-notify} and
+@code{sb-thread:condition-broadcast}.
+@end itemize
+
+@include macro-sb-thread-barrier.texinfo
+
 @node Sessions/Debugging
 @comment  node-name,  next,  previous,  up
 @section Sessions/Debugging