projects
/
sbcl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
0.9.13.52: Windows installer tweaks
[sbcl.git]
/
src
/
code
/
thread.lisp
diff --git
a/src/code/thread.lisp
b/src/code/thread.lisp
index
ab393f5
..
37e89ac
100644
(file)
--- a/
src/code/thread.lisp
+++ b/
src/code/thread.lisp
@@
-11,6
+11,20
@@
(in-package "SB!THREAD")
(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
(sb!xc:defmacro with-mutex ((mutex &key (value '*current-thread*) (wait-p t))
&body body)
#!+sb-doc
@@
-22,6
+36,7
@@
and the mutex is in use, sleep until it is available"
(with-unique-names (got mutex1)
`(let ((,mutex1 ,mutex)
,got)
(with-unique-names (got mutex1)
`(let ((,mutex1 ,mutex)
,got)
+ (/show0 "WITH-MUTEX")
(unwind-protect
;; FIXME: async unwind in SETQ form
(when (setq ,got (get-mutex ,mutex1 ,value ,wait-p))
(unwind-protect
;; FIXME: async unwind in SETQ form
(when (setq ,got (get-mutex ,mutex1 ,value ,wait-p))
@@
-43,7
+58,8
@@
further recursive lock attempts for the same mutex succeed. It is
allowed to mix WITH-MUTEX and WITH-RECURSIVE-LOCK for the same mutex
provided the default value is used for the mutex."
#!-sb-thread
allowed to mix WITH-MUTEX and WITH-RECURSIVE-LOCK for the same mutex
provided the default value is used for the mutex."
#!-sb-thread
- (declare (ignore mutex)) #!+sb-thread
+ (declare (ignore mutex))
+ #!+sb-thread
(with-unique-names (mutex1 inner-lock-p)
`(let* ((,mutex1 ,mutex)
(,inner-lock-p (eq (mutex-value ,mutex1) *current-thread*)))
(with-unique-names (mutex1 inner-lock-p)
`(let* ((,mutex1 ,mutex)
(,inner-lock-p (eq (mutex-value ,mutex1) *current-thread*)))