- "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"
- `(call-with-mutex
- (lambda () ,@body)
- ,mutex
- ,value
- ,wait-p))
-
-(sb!xc:defmacro with-system-mutex ((mutex &key without-gcing) &body body)
- `(call-with-system-mutex
- (lambda () ,@body)
- ,mutex
- ,without-gcing))
+ "Acquire MUTEX for the dynamic scope of BODY, setting it to 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"
+ `(dx-flet ((with-mutex-thunk () ,@body))
+ (call-with-mutex
+ #'with-mutex-thunk
+ ,mutex
+ ,value
+ ,wait-p)))
+
+(sb!xc:defmacro with-system-mutex ((mutex
+ &key without-gcing allow-with-interrupts)
+ &body body)
+ `(dx-flet ((with-system-mutex-thunk () ,@body))
+ (,(cond (without-gcing
+ 'call-with-system-mutex/without-gcing)
+ (allow-with-interrupts
+ 'call-with-system-mutex/allow-with-interrupts)
+ (t
+ 'call-with-system-mutex))
+ #'with-system-mutex-thunk
+ ,mutex)))
+
+(sb!xc:defmacro with-system-spinlock ((spinlock &key) &body body)
+ `(dx-flet ((with-system-spinlock-thunk () ,@body))
+ (call-with-system-spinlock
+ #'with-system-spinlock-thunk
+ ,spinlock)))