about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2022-04-06 22:15:43 +0200
committerMara Bos <m-ou.se@m-ou.se>2022-04-12 08:44:39 +0200
commit83e8b9e4ddf41def776ad7d3724f308e689ad063 (patch)
tree525b4d1e0c6602e67bb6df26c1e32d619e05b7cd
parent43651aa34fd7762058aea6920d2e401561d97076 (diff)
downloadrust-83e8b9e4ddf41def776ad7d3724f308e689ad063.tar.gz
rust-83e8b9e4ddf41def776ad7d3724f308e689ad063.zip
Add debug asserts to futex ReentrantMutex impl.
-rw-r--r--library/std/src/sys/unix/locks/futex.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/std/src/sys/unix/locks/futex.rs b/library/std/src/sys/unix/locks/futex.rs
index 0c7fb098c5f..d97777e4da2 100644
--- a/library/std/src/sys/unix/locks/futex.rs
+++ b/library/std/src/sys/unix/locks/futex.rs
@@ -215,6 +215,7 @@ impl ReentrantMutex {
             true
         } else if self.mutex.try_lock() {
             self.owner.store(this_thread, Relaxed);
+            debug_assert_eq!(*self.lock_count.get(), 0);
             *self.lock_count.get() = 1;
             true
         } else {
@@ -229,6 +230,7 @@ impl ReentrantMutex {
         } else {
             self.mutex.lock();
             self.owner.store(this_thread, Relaxed);
+            debug_assert_eq!(*self.lock_count.get(), 0);
             *self.lock_count.get() = 1;
         }
     }