@@ -188,6 +188,9 @@ Related:
188
188
#- (or ccl sbcl)
189
189
(assert nil nil " Unimplemented: HOLDING-MUTEX-P" ))
190
190
191
+ (defmacro with-mutex ((m) &body body) ` (sb-thread :with-mutex (, m) ,@ body))
192
+
193
+ #+ nil
191
194
(defmacro with-mutex ((mutex &key (lock t ) (reenter t ) (protect t ) (inline :default ))
192
195
&environment env &body body)
193
196
" Defines BODY as a critical section that is guarded by MUTEX.
@@ -225,6 +228,7 @@ there is still possibility that the MUTEX remains locked resulting in an undefin
225
228
(, lock-form (, mutex) (&body ))
226
229
(&body ))))))))
227
230
231
+ #+ nil
228
232
(defmacro with-mutex-once ((mutex) &environment env &body body)
229
233
" Executes BODY while holding the MUTEX.
230
234
Checks that the current thread is NOT the owner of the MUTEX."
@@ -236,6 +240,7 @@ Checks that the current thread is NOT the owner of the MUTEX."
236
240
(with-recursive-lock-held (, mutex)
237
241
(locally ,@ body)))))
238
242
243
+ #+ nil
239
244
(defmacro with-unprotected-mutex ((mutex &key (lock t ) (reenter t ))
240
245
&environment env &body body)
241
246
" Like WITH-MUTEX but without an (expensive) UNWIND-PROTECT.
@@ -270,6 +275,7 @@ If REENTER is NIL and the MUTEX is owned by the current thread, a MUTEX-ERROR is
270
275
(error ' mutex-error " Unwind with an unprotected mutex ~A !" , mutex)))))
271
276
(form)))))
272
277
278
+ #+ nil
273
279
(defmacro with-unprotected-mutex-once ((mutex &key (lock t )) &body body)
274
280
" Like WITH-MUTEX-ONCE but without an (expensive) UNWIND-PROTECT.
275
281
The mutex is locked if the LOCK form evaluates to non-nil at runtime.
@@ -313,6 +319,7 @@ The promise must not be fulfilled, yet."
313
319
(dcheck (promise-fulfilled-p promise))
314
320
(cdr promise))
315
321
322
+ #+ nil
316
323
(defun %with-value-computed-once (promise body)
317
324
(declare (promise promise) (function body))
318
325
; ; Check if promise is not fulfilled, yet?
@@ -328,6 +335,7 @@ The promise must not be fulfilled, yet."
328
335
; ; Return results.
329
336
(promise-value promise))
330
337
338
+ #+ nil
331
339
(defmacro with-value-computed-once ((promise) &body body)
332
340
" Compute the value of the BODY only once and store it in the PROMISE.
333
341
0 commit comments