This way added earlier as a way of telling how many listeners were woken
up by a notify() call. It's very simple to implement with the mutex
strategy.
Signed-off-by: John Nunley <dev@notgull.net>
For now it just creates a listener on the heap. We can rework this
later, maybe to include stack listeners. For now it's best to keep it
this way, I feel.
Signed-off-by: John Nunley <dev@notgull.net>
The Listener trait was previously used to abstract over heap and stack
based event listeners. However at this point we only have heap based
event listeners. Still, to avoid a breaking change we need to have this
trait.
Other minor fixups include:
- Make the locking ignore poisoning.
- Reduce formatting code
Signed-off-by: John Nunley <dev@notgull.net>
This commit adds back a feature that allows one to use portable-atomic
instead of regular atomics.
Kind of useless without no-std, but it's here again.
Signed-off-by: John Nunley <dev@notgull.net>
This commit re-adds the "notify.rs" file pretty much verbatim. This
allows for tagged notifications to be used, i.e. convey additional
control information along with the notification. The tags are stored in
the links with the notification.
This also adds some tests for the new functionality.
Signed-off-by: John Nunley <dev@notgull.net>
This commit adds back the <T> parameter on Event and EventListener. So
far nothing is done with the generic parameter. However it will
eventually be used to bring back tagged events.
Signed-off-by: John Nunley <dev@notgull.net>
@taiki-e's commits since v2.5.3 aren't the problem, as they only change
CI/framing details. This commit brings back all work by @taiki-e.
Co-authored-by: John Nunley <dev@notgull.net>
Signed-off-by: John Nunley <dev@notgull.net>
I'm man enough to know when I've been wrong.
The intrusive-list-based list implementation is riddled with bugs, fails
MIRI, and overall increases the complexity of this crate. I've invested
a lot of time and energy into improving it; effort which I feel has been
wasted. So I figure I'll cut my losses and revert.
This PR undoes every commit made between now and the release of
event-listener version 2.5.3. The next commits will be replaying newer
features in order to avoid a breaking change.
Signed-off-by: John Nunley <dev@notgullnet>
This commit adds tests to CI that tests new patches for event-listener
with dependent crates. Examples of these dependent crates are:
- event-listener-strategy
- async-channel
- async-lock
Signed-off-by: John Nunley <dev@notgull.net>
This commit makes the panic message for a listener that's not inserted
into the linked list much clearer. The goal is to convey to the user
that they may be `poll`ing the listener after it has completed.
This commit also fixes some new Clippy lints.
cc #124
Signed-off-by: John Nunley <dev@notgull.net>
* Make sure Unpin is implemented for StackListener
* Purge the prelude
* Remove unused imports from doctests
Signed-off-by: John Nunley <dev@notgull.net>
Minimal amount of changes to make EventListener a heap-allocated type
again. The existence of the EventListener implies that it is already
listening; accordingly the new() and listen() methods on EventListener
have been removed.
cc #104
Signed-off-by: John Nunley <dev@notgull.net>
This commit makes it so EventListener::listen() does not overwrite
existing listeners if they already exist. If the listener is already
registered in an event listener list, it removes the listener from that
list before registering the new listener. This soundness bug was missed
during #94.
This is a patch-compatible fix for #100. We may also want an API-level
fix for #100 as well. This is up for further discussion.
Signed-off-by: John Nunley <dev@notgull.net>
This is a breaking change. It makes `new()` take no parameters in its
signature and `listen()` take a reference to an event in its signature.
This should avoid a footgun where a listener can be waited on without
listening on it.
Closes#91
Signed-off-by: John Nunley <dev@notgull.net>