-
Notifications
You must be signed in to change notification settings - Fork 341
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
[tracking] sync #217
Comments
I could take a look at |
@tmccombs that'd be great! |
I looked into this briefly when trying to improve For the wait with timeout APIs, it's basically |
I think I'm pretty close (See #369). However, my implementation of Another option is to keep an atomic bool with each waker to keep track of if that waker has been woken by a call to notify. But that seems kind of heavy for this. |
I think it should be a regular notify. Condvar timeouts are never meant to be precise. If we prioritise timeout to a regular notify, then we may lose a notify_one call if we are notifying an user that is very close to timeout, which isn't really desirable. I looked at your implementation and have a few worries:
|
I wonder how useful Maybe we can just omit |
I think it should be possible provided that |
@nbdd0121 do you have any suggestion on how to resolve your concerns? |
* Implement async_std::sync::Condvar Part of #217 * More rigourous detection of notification for condvar * Use state of Waker instead of AtomicUsize to keep track of if task was notified. * Add test for notify_all * Implement wait_timeout_until And add warnings about spurious wakeups to wait and wait_timeout * Use WakerSet for Condvar This should also address concerns about spurious wakeups. * Add test for wait_timeout with no lock held * Add comments describing AwaitNotify struct And remove an unnneded comment in a Debug implementation
This is a tracking issue for feature parity with
std::sync
. Not everything needs to be ported, but this is a full overview of what's instd::sync
andasync_std::sync
.@stjepang could you take a look and cross off what's not needed? I think we have most of it except maybe
Barrier
,Condvar
, andArc
. Thanks!Structs
sync::Arc
sync::Condvar
sync::Mutex
sync::Barrier
sync::BarrierWaitResult
sync::MutexGuard
sync::Once
sync::PoisonError
(not required)sync::RwLock
sync::RwLockReadGuard
sync::RwLockWriteGuard
sync::WaitTimeoutResult
sync::Weak
Enums
sync::TryLockError
(not required)The text was updated successfully, but these errors were encountered: