From: Matt Birkholz Date: Tue, 5 Jun 2018 07:22:28 +0000 (-0700) Subject: Signal an error in unlock-thread-mutex when mutex is not owned, X-Git-Tag: mit-scheme-pucked-x11-0.3.1~6^2~17 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=24a44fb26e4e4b2f899e66bba107f6e36dce65a9;p=mit-scheme.git Signal an error in unlock-thread-mutex when mutex is not owned, before applying remove-thread-mutex! to #f, which produces a less helpful error message. --- diff --git a/src/runtime/thread.scm b/src/runtime/thread.scm index 5ea1867f9..693aacd28 100644 --- a/src/runtime/thread.scm +++ b/src/runtime/thread.scm @@ -1211,7 +1211,8 @@ USA. (without-interrupts (lambda () (let ((owner (thread-mutex/owner mutex))) - (if (and owner (not (eq? owner (current-thread)))) + (if (or (not owner) + (not (eq? owner (current-thread)))) (error "Don't own mutex:" mutex)) (%unlock-thread-mutex mutex owner)))))