flume
flume copied to clipboard
Add spinlock implementation without `std::thread::sleep`
This pull request adds a spin-plain
feature that uses a spinlock-based locking system like the spin
feature does, but without using std::thread::sleep
. 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 the wasm32-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 the wait_lock
function in flume has two different implementations and both of them are blocking, including the current spinlock-based one.