Skip to content

Redox: Fix Condvar.wait(); do not lock mutex twice #43082

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

Merged
merged 1 commit into from
Jul 9, 2017

Conversation

ids1024
Copy link
Contributor

@ids1024 ids1024 commented Jul 6, 2017

The atomic_xchg() loop locks the mutex, so the call to mutex_lock is
incorrect, and blocks.

@alexcrichton alexcrichton added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 6, 2017
@alexcrichton alexcrichton self-assigned this Jul 6, 2017
@alexcrichton
Copy link
Member

@bors: r+ rollup

@bors
Copy link
Collaborator

bors commented Jul 6, 2017

📌 Commit 86191f4 has been approved by alexcrichton

@bors
Copy link
Collaborator

bors commented Jul 6, 2017

🔒 Merge conflict

@sfackler
Copy link
Member

sfackler commented Jul 6, 2017

Is there a test for this stuff? I'm assuming the previous behavior would be an immediate deadlock as soon as the convar wakes up?

@ids1024
Copy link
Contributor Author

ids1024 commented Jul 6, 2017

I'm assuming the previous behavior would be an immediate deadlock as soon as the convar wakes up?

Yes.

The implementation now matches https://locklessinc.com/articles/mutex_cv_futex/, which @jackpot51 says he used as a reference to implement it; it seems this line was added by accident.

I don't see a test for Condvar in the rust repository; if anyone has a test to recommend, feel free.

@shepmaster shepmaster added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 7, 2017
@shepmaster
Copy link
Member

Heads up, @ids1024; you've got a merge conflict.

@ids1024
Copy link
Contributor Author

ids1024 commented Jul 7, 2017

But what merge conflict? It seems to merge cleanly with master, and the only file changed here is a Redox-specific file that hasn't been changed in months.

@alexcrichton
Copy link
Member

@ids1024 you'll want to just rebase against rust-lang/rust's master branch

The atomic_xchg() loop locks the mutex, so the call to mutex_lock is
incorrect, and blocks.
@jackpot51
Copy link
Contributor

@alexcrichton it has been rebased.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Collaborator

bors commented Jul 9, 2017

📌 Commit 59981e4 has been approved by alexcrichton

@bors
Copy link
Collaborator

bors commented Jul 9, 2017

⌛ Testing commit 59981e4 with merge 12fef71...

bors added a commit that referenced this pull request Jul 9, 2017
Redox: Fix Condvar.wait(); do not lock mutex twice

The atomic_xchg() loop locks the mutex, so the call to mutex_lock is
incorrect, and blocks.
@bors
Copy link
Collaborator

bors commented Jul 9, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 12fef71 to master...

@bors bors merged commit 59981e4 into rust-lang:master Jul 9, 2017
@ids1024 ids1024 deleted the condvar2 branch October 5, 2017 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants