Skip to content

Commit

Permalink
Add debug asserts to futex ReentrantMutex impl.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ou-se committed Apr 7, 2022
1 parent dc82718 commit aeb01c3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions library/std/src/sys/unix/locks/futex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
}
}
Expand Down

0 comments on commit aeb01c3

Please sign in to comment.