-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
Add spinlock implementation without std::thread::sleep
#138
Conversation
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.
Thanks for the reminder, this PR flew under the radar.
Great, thanks for the PR! |
?? |
maybe a ci wasm build check would be nice? to guarantee that doesn't break again |
@zesterer ?? |
Sorry about that. I replied, ran CI, then didn't get back to this. Anyhow, much appreciated! |
Tysm!! Would it be possible to get this published on crates.io as well? |
@zesterer I'm sorry for constantly pinging you- but it seems to be the only way to get your attention? |
I should have some free time tomorrow to do this, thanks for the reminder. |
Not forgotten about this, trying to find the time to write up what turns out to be quite an extensive changelog! |
take your time, we appreciate your efforts :-) |
I've just released |
incredible. thanks! |
This pull request adds aspin-plain
feature that uses a spinlock-based locking system like thespin
feature does, but without usingstd::thread::sleep
. Closes #137.Edit: This pull request changes the
spin
feature to only usestd::thread::sleep
on Unix and Windows. Closes #137.Some targets like
wasm32-unknown-unknown
don't support blocking, so you won't be able to use flume on those platforms without this new feature. Even if you enable-Ctarget-feature=+atomics,+bulk-memory,+mutable-globals
on thewasm32-unknown-unknown
target, flume still doesn't work on the main thread of a web browser, it only works in web workers. See #137 for more details about this, but essentially the problem is that thewait_lock
function in flume has two different implementations and both of them are blocking, including the current spinlock-based one.