smol-rs / event-listener

Notify async tasks or threads
Apache License 2.0
449 stars 30 forks source link

Setup a faster, less footgun-prone API #105

Closed notgull closed 9 months ago

notgull commented 11 months ago

This PR sets up a new API that aims to implement #104. It sets up a Listener trait, which is implemented for a heap-based EventListener and a stack-based StackListener. The latter is only able to be instantiated through the "listener!" macro.

While writing this, I realized that this breaks the hand-rolled futures that async-channel and async-lock use nowadays. For now we can burn that bridge when we get there and just use EventListener in the hand-rolled futures.

Closes #104

notgull commented 10 months ago

It appears that this somehow introduces a deadlock into async-lock. See the test failure here: https://github.com/smol-rs/async-lock/actions/runs/7493609820/job/20509520336

zeenix commented 9 months ago

It appears that this somehow introduces a deadlock into async-lock. See the test failure here: https://github.com/smol-rs/async-lock/actions/runs/7493609820/job/20509520336

Any progress on this? If this is proving difficult and will take time, perhaps we can first have other crates ported to event-handler 4 so folks don't end up depending on multiple versions of event-handler?

notgull commented 9 months ago

Any progress on this?

None yet. At the moment I'm still trying to replicate the deadlock using only event-listener.

If this is proving difficult and will take time, perhaps we can first have other crates ported to event-handler 4 so folks don't end up depending on multiple versions of event-handler?

I would agree with this. Most of the smol crates are already ported to event-listener v4.

zeenix commented 9 months ago

If this is proving difficult and will take time, perhaps we can first have other crates ported to event-handler 4 so folks don't end up depending on multiple versions of event-handler?

I would agree with this. Most of the smol crates are already ported to event-listener v4.

Cool. I'll see if I can provide a PR for async-broadcast. Any others left?

notgull commented 9 months ago

Not to my knowledge

notgull commented 9 months ago

At the moment I think the deadlock is a Miri bug, so I've disabled those tests in https://github.com/smol-rs/async-lock/pull/74/commits/1d97f8a8879e069f2438627cad64f7354d5db1e1. I think this should be ready now.