Skip to content

Commit aeb01c3

Browse files
committed
Add debug asserts to futex ReentrantMutex impl.
1 parent dc82718 commit aeb01c3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/std/src/sys/unix/locks/futex.rs

+2
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ impl ReentrantMutex {
215215
true
216216
} else if self.mutex.try_lock() {
217217
self.owner.store(this_thread, Relaxed);
218+
debug_assert_eq!(*self.lock_count.get(), 0);
218219
*self.lock_count.get() = 1;
219220
true
220221
} else {
@@ -229,6 +230,7 @@ impl ReentrantMutex {
229230
} else {
230231
self.mutex.lock();
231232
self.owner.store(this_thread, Relaxed);
233+
debug_assert_eq!(*self.lock_count.get(), 0);
232234
*self.lock_count.get() = 1;
233235
}
234236
}

0 commit comments

Comments
 (0)