Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upCondVar wait functions accepting a closure #47960
Comments
This comment has been minimized.
This comment has been minimized.
|
Generally, for small features, we just take PRs, and for big ones, issues. I'm not sure if @rust-lang/libs considers this a small or large feature. |
This comment has been minimized.
This comment has been minimized.
|
This seems small enough for a direct PR, yes. |
This comment has been minimized.
This comment has been minimized.
|
Will prepare it. Still a little new to rust. Would the callback be Fn or FnMut? |
This comment has been minimized.
This comment has been minimized.
|
|
vlovich
referenced this issue
Feb 2, 2018
Merged
Add Condvar APIs not susceptible to spurious wake #47970
cuviper
added
A-concurrency
T-libs
C-feature-request
labels
Feb 2, 2018
dtolnay
added
C-feature-accepted
and removed
C-feature-request
labels
Feb 16, 2018
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
Feb 25, 2018
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
Feb 25, 2018
kennytm
added a commit
to kennytm/rust
that referenced
this issue
Feb 25, 2018
jonas-schievink
added
C-tracking-issue
B-unstable
and removed
C-feature-accepted
labels
Mar 24, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
vlovich commentedFeb 2, 2018
•
edited
Pretty common for conditional variable classes to provide wait variants that accept a closure that returns a boolean indicating whether or not the condition has been satisfied. This would be a pretty nice ergonomic improvement to using CondVar. Something like
cvar.wait_until(lock, || { some condition }). Even more useful would be await_timeout_untilwhich would avoid the need to keep track of elapsed time if the condition variable might get notified several times before the condition is met.