From: Taylor R Campbell Date: Sun, 16 Nov 2014 18:53:28 +0000 (+0000) Subject: Sternly advise against non-debugging use of THREAD-MUTEX-OWNER. X-Git-Tag: mit-scheme-pucked-9.2.12~376^2~111 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=576ab7361f08756033e7e2c1a2f44ac74c233ad9;p=mit-scheme.git Sternly advise against non-debugging use of THREAD-MUTEX-OWNER. --- 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))