-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Synchronization primitive cleanup #1441
Conversation
…eue with (un)block; comments
… on some platforms)
|
||
if this.rwlock_reader_unlock(id, active_thread) { | ||
// The thread was a reader. | ||
if this.rwlock_is_locked(id) { | ||
if this.rwlock_is_locked(id).not() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vakaras there was a crucial negation missing here. I added a testcase as well to ensure that with the negation, it does the right thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for catching and fixing this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Make some methods infallible
I used fallible methods everywhere to accommodate future changes that could potentially make them fail. However, that probably is not worth it.
|
||
if this.rwlock_reader_unlock(id, active_thread) { | ||
// The thread was a reader. | ||
if this.rwlock_is_locked(id) { | ||
if this.rwlock_is_locked(id).not() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for catching and fixing this!
@bors r+ |
📌 Commit 0b6ec57 has been approved by |
☀️ Test successful - checks-travis, status-appveyor |
Make some methods infallible, move a bit more work into the platform-independent
sync.rs
, and fix a bug in rwlock unlocking.