From f519c709b387e350cdf3ffc71e31c9fbfbb502e5 Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Sun, 19 Oct 2025 07:36:50 +0300 Subject: Added checks against releasing an untaken lock --- src/rw-lock.lisp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/rw-lock.lisp b/src/rw-lock.lisp index b32d3d0..bd2606c 100644 --- a/src/rw-lock.lisp +++ b/src/rw-lock.lisp @@ -72,6 +72,7 @@ (check-type rw-lock rw-lock) (with-slots (lock unlocked readers has-writer) rw-lock (with-lock-held (lock) + (assert (> readers 0) nil "Trying to release a read lock that's not taken!") (decf readers) (when (zerop readers) (condition-broadcast unlocked)))) @@ -117,6 +118,7 @@ (check-type rw-lock rw-lock) (with-slots (lock unlocked readers has-writer) rw-lock (with-lock-held (lock) + (assert has-writer nil "Trying to release a write lock that's not taken!") (setf has-writer nil) (condition-broadcast unlocked))) rw-lock) -- cgit v1.2.3