-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: add Semaphore
and Notify
#8
base: main
Are you sure you want to change the base?
Conversation
|
||
#[derive(Default)] | ||
pub struct NotifyInner { | ||
pending_notify: usize, |
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.
I think tokio just uses a boolean here, but I think this makes more sense?
inner: self.0.clone(), | ||
notify_state: Default::default(), | ||
} | ||
} |
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.
Nothing really happens with the internal state of Notify
until the future is polled. Is that ok?
semaphore: self.clone(), | ||
is_future_dropped: Default::default(), | ||
} | ||
} |
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.
An acquire
actually doesn't take place until the future is polled. Is that ok?
Lifted from https://github.com/dprint/dprint/blob/main/crates/dprint/src/utils/unsync.rs