Add debug asserts to futex ReentrantMutex impl.

This commit is contained in:
Mara Bos 2022-04-06 22:15:43 +02:00
parent 43651aa34f
commit 83e8b9e4dd

View file

@ -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;
}
}