event-listener
event-listener copied to clipboard
[Question] Integration with loom or shuttle?
Hi,
This package has been a lifesaver. I really unable to implement https://github.com/rmcgibbo/async-priority-channel (which whos API is basically copied completely from smol-rs/async-channel) without out.
One question: would it be straightforward/possible for event-listener to provide a hook to use loom or shuttle. I'd like to be able to test my code which depends on event-listener using these techniques if possible. https://github.com/tokio-rs/loom/pull/220 seems to indicate that the latest release of loom now handles SeqCst which is probably necessary.
I would accept a PR to support loom in a similar way as https://github.com/crossbeam-rs/crossbeam/pull/487.
I looked into this a bit tonight. It seems like event-listener relies heavily on std::thread::park()
and std::thread::unpark
which are not implemented yet on loom::thread
. This PR added loom::thread
without park: https://github.com/tokio-rs/loom/pull/175. This question seems to indicate that yield_now might be a substitute for park, but I don't think that'll work for event-listener at all. https://github.com/tokio-rs/loom/issues/133
Without park, it seems like the loom version and the normal version of event-listener would have to be very different (replace park/unpark with an extra loom::sync::mutex and loom::sync::condvar?), which is not desirable.
It seems https://github.com/tokio-rs/loom/issues/133 has been resolved.