Skip to content
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

Support passing values through the Mutex inside the parker #21

Open
james7132 opened this issue Feb 14, 2024 · 1 comment
Open

Support passing values through the Mutex inside the parker #21

james7132 opened this issue Feb 14, 2024 · 1 comment

Comments

@james7132
Copy link

james7132 commented Feb 14, 2024

The caller of Unparker::unpark briefly has the lock on the Mutex before notifying the condvar. Would it be feasible to pass a Send value through the Mutex to the unparked thread for it to consume? Perhaps, say, a async_task runnable? If the threads already unparked or never was to begin with,unpark can just return back an error containing the value.

@notgull
Copy link
Member

notgull commented Feb 17, 2024

This might be a breaking change. However as this crate isn't directly re-exported by smol I would be fine with a break.

I guess this would have the same point as tagged events in event-listener. I mostly just want to keep the ergonomics of Parker intact so it can be used in, e.g., futures-lite and async-io.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants