From 24a44fb26e4e4b2f899e66bba107f6e36dce65a9 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Tue, 5 Jun 2018 00:22:28 -0700 Subject: [PATCH] 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. --- src/runtime/thread.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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))))) -- 2.25.1