+;;;; This software is part of the SBCL system. See the README file for
+;;;; more information.
+;;;;
+;;;; This software is derived from the CMU CL system, which was
+;;;; written at Carnegie Mellon University and released into the
+;;;; public domain. The software is in the public domain and is
+;;;; provided with absolutely no warranty. See the COPYING and CREDITS
+;;;; files for more information.
+
+(in-package "SB!THREAD")
+
+(def!struct mutex
+ #!+sb-doc
+ "Mutex type."
+ (name nil :type (or null simple-string))
+ (value nil)
+ #!+(and sb-lutex sb-thread)
+ (lutex (make-lutex)))
+
+(def!struct spinlock
+ #!+sb-doc
+ "Spinlock type."
+ (name nil :type (or null simple-string))
+ (value 0))
+
+(sb!xc:defmacro with-mutex ((mutex &key (value '*current-thread*) (wait-p t))
+ &body body)
+ #!+sb-doc
+ "Acquire MUTEX for the dynamic scope of BODY, setting it to
+NEW-VALUE or some suitable default value if NIL. If WAIT-P is non-NIL
+and the mutex is in use, sleep until it is available"
+ #!-sb-thread (declare (ignore mutex value wait-p))