Skip to content
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

Merged
merged 5 commits into from
May 31, 2020
Merged

Conversation

RalfJung
Copy link
Member

Make some methods infallible, move a bit more work into the platform-independent sync.rs, and fix a bug in rwlock unlocking.


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() {
Copy link
Member Author

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.

Copy link
Contributor

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!

Copy link
Contributor

@vakaras vakaras left a 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() {
Copy link
Contributor

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!

@RalfJung
Copy link
Member Author

@bors r+

@bors
Copy link
Contributor

bors commented May 31, 2020

📌 Commit 0b6ec57 has been approved by RalfJung

@bors
Copy link
Contributor

bors commented May 31, 2020

⌛ Testing commit 0b6ec57 with merge 4fd0aa3...

@bors
Copy link
Contributor

bors commented May 31, 2020

☀️ Test successful - checks-travis, status-appveyor
Approved by: RalfJung
Pushing 4fd0aa3 to master...

@bors bors merged commit 4fd0aa3 into rust-lang:master May 31, 2020
@RalfJung RalfJung deleted the sync-cleanup branch May 31, 2020 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants