-
Notifications
You must be signed in to change notification settings - Fork 8
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
Implement loom version of parking #8
Conversation
The CI isn't running for some reason, let me try closing and reopening. |
don't worry CI auto-disabled due to infrequent usage |
Should work after rebasing this branch against |
src/lib.rs
Outdated
use std::cell::Cell; | ||
use std::fmt; | ||
use std::marker::PhantomData; | ||
use std::sync::atomic::AtomicUsize; | ||
use std::sync::atomic::Ordering::SeqCst; | ||
use std::sync::{Arc, Condvar, Mutex}; | ||
use std::time::{Duration, Instant}; |
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.
Are these used when #[cfg(loom)]
is active?
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.
Yes. I import either the std::sync
or loom::sync
module based on the configuration, and then I import synchronization primitives straight from the resulting sync
module.
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.
nah, I'm talking about std::time::* stuff...
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.
Duration
is used but Instant
is not. This should now be fixed.
@smol-rs/admins Any blockers to this being merged? |
In smol-rs/event-listener#30, I implemented my own version of
parking
using Loom primitives. @zseri asked me to upstream it to this repository. This PR adds a new "loom" feature that, when the Rust--cfg loom
flag is enabled, reimplementsparking
using Loom primitives.Since
loom
doesn't support timeouts there's not much that I can really do in terms of testing, so I just added a simple smoke test.