From 576ab7361f08756033e7e2c1a2f44ac74c233ad9 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sun, 16 Nov 2014 18:53:28 +0000 Subject: [PATCH] Sternly advise against non-debugging use of THREAD-MUTEX-OWNER. --- src/runtime/thread.scm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/runtime/thread.scm b/src/runtime/thread.scm index c9c766ffd..902bbcf1d 100644 --- a/src/runtime/thread.scm +++ b/src/runtime/thread.scm @@ -1048,6 +1048,12 @@ USA. (error "Don't own mutex:" mutex) (error "Don't own mutex:" mutex caller)))) +;;; Never use THREAD-MUTEX-OWNER except as a debugging feature. If you +;;; are tempted to make locking decisions on the basis of who owns a +;;; mutex, fix your design so you're no longer tempted. Mutexes are +;;; non-recursive. Use ASSERT-THREAD-MUTEX-OWNED to assert that you +;;; own a mutex so you're less tempted to call THREAD-MUTEX-OWNER ever. + (define (thread-mutex-owner mutex) (guarantee-thread-mutex mutex 'THREAD-MUTEX-OWNER) (thread-mutex/owner mutex)) -- 2.25.1