Commit Graph

198 Commits

Author SHA1 Message Date
John Nunley 2493d3c595 ci: Also add MIRI tests
Signed-off-by: John Nunley <dev@notgull.net>
2024-04-08 14:27:51 -07:00
John Nunley c56420dcf4 ci: Add CI tests for dependent crates
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>
2024-04-08 14:27:51 -07:00
John Nunley db5857b0b7 v5.3.0
Signed-off-by: John Nunley <dev@notgull.net>
2024-04-05 08:40:07 -07:00
Jacob Rothstein f402b7e24c feat: Add a loom implementation for event-listener 2024-03-30 12:00:55 -07:00
John Nunley 58dbfc8bc5 docs: Make empty listener panic clearer
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>
2024-03-28 08:37:08 -07:00
John Nunley 8f11a87281
v5.2.0
Signed-off-by: John Nunley <dev@notgull.net>
2024-02-28 21:15:47 -08:00
John Nunley c9d736a29b
feat: Mark StackSlot as Sync
Since it has no interior mutability it should be safe to share between
threads.

Signed-off-by: John Nunley <dev@notgull.net>
2024-02-25 18:02:44 -08:00
John Nunley 3a49a00639 v5.1.0
Signed-off-by: John Nunley <dev@notgull.net>
2024-02-17 21:37:31 -08:00
Matt Klein e5464b4fdc StackSlot should be send
Signed-off-by: Matt Klein <mklein@bitdrift.io>
2024-02-10 09:53:46 -08:00
Zeeshan Ali Khan ec0c6f9d67
Merge pull request #117 from smol-rs/notgull/next
v5.0.0
2024-02-05 23:10:02 +01:00
John Nunley 4c3568010a
v5.0.0
Signed-off-by: John Nunley <dev@notgull.net>
2024-02-04 19:23:00 -08:00
John Nunley 6e6202b3f1 chore: Polish the implementation of the new API
* Make sure Unpin is implemented for StackListener
* Purge the prelude
* Remove unused imports from doctests

Signed-off-by: John Nunley <dev@notgull.net>
2024-02-03 09:49:22 -08:00
John Nunley 6fc00c0f3f feat: Move Future impl to forwarding macro
Signed-off-by: John Nunley <dev@notgull.net>
2024-02-03 09:49:22 -08:00
John Nunley e0fefc28b1 ex: Remove unsafe code from mutex example
This brings in the try-lock dependency.

Signed-off-by: John Nunley <dev@notgull.net>
2024-02-03 09:49:22 -08:00
John Nunley 68be5281d7 feat: Add stack-based listener
It is instantiated with the listener!() macro.

Signed-off-by: John Nunley <dev@notgull.net>
2024-02-03 09:49:22 -08:00
John Nunley d9144a8a41 feat: Create Listener trait
This commit creates the Listener trait and moves most of EventListener's
functionality to that trait.

Signed-off-by: John Nunley <dev@notgull.net>
2024-02-03 09:49:22 -08:00
John Nunley 86b778074c feat: Move EventListener back onto the heap
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>
2024-02-03 09:49:22 -08:00
John Nunley ac18bdf617
chore: Fix up some minor bits before release
Signed-off-by: John Nunley <dev@notgull.net>
2024-01-27 12:21:00 -08:00
Linken Quy Dinh a68f5ee1b0
feat: Add a way to get the current number of listeners 2024-01-24 20:59:40 -08:00
Taiki Endo 5f5135ed81 Remove RefCell<Option> from PARKER 2024-01-07 22:28:46 +09:00
Taiki Endo b1d437ae83 Release 4.0.3 2024-01-07 03:03:27 +09:00
Taiki Endo aade0393e8 Relax MSRV to 1.60
https://github.com/crossbeam-rs/crossbeam/pull/1056
2024-01-07 02:52:24 +09:00
Taiki Endo 45272f9285 ci: Use cargo-hack's --rust-version flag for msrv check
This respects rust-version field in Cargo.toml, so it removes the need
to manage MSRV in both the CI file and Cargo.toml.
2024-01-07 02:52:24 +09:00
dependabot[bot] 08c7e163a0
Update criterion requirement from 0.4.0 to 0.5.1 (#62)
Updates the requirements on [criterion](https://github.com/bheisler/criterion.rs) to permit the latest version.
- [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bheisler/criterion.rs/compare/0.4.0...0.5.1)

---
updated-dependencies:
- dependency-name: criterion
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-07 01:39:35 +09:00
John Nunley 9e986e614a
v4.0.2
Signed-off-by: John Nunley <dev@notgull.net>
2024-01-01 12:13:55 -08:00
Anton e0c8290f0d
bugfix: Avoid spinning when waiting for deadline 2023-12-25 07:30:31 -08:00
John Nunley ea0f6016ea
v4.0.1
Signed-off-by: John Nunley <dev@notgull.net>
2023-12-19 08:40:55 -08:00
John Nunley c2d1ccb7ae
bugfix: Remove listener if one already exists
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>
2023-12-18 07:28:51 -08:00
John Nunley cc33cc5467
Bump MSRV to 1.61 (#102)
This commit also adds portable-atomic tests for MIRI.

Signed-off-by: John Nunley <dev@notgull.net>
2023-12-16 12:44:52 -08:00
John Nunley 531c106f0e
v4.0.0
Signed-off-by: John Nunley <dev@notgull.net>
2023-11-19 09:38:08 -08:00
John Nunley 21b34bf6dd
breaking: Fix the EventListener::new() footgun
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>
2023-11-15 06:01:17 -08:00
John Nunley e6ec597886
v3.1.0
Signed-off-by: John Nunley <dev@notgull.net>
2023-11-12 16:14:53 -08:00
Pierre Krieger 3f0d516c80
feat: Implement `UnwindSafe` for `EventListener` 2023-11-12 12:49:31 -08:00
dependabot[bot] c42dc40785 Update futures-lite requirement from 1.12.0 to 2.0.0
Updates the requirements on [futures-lite](https://github.com/smol-rs/futures-lite) to permit the latest version.
- [Release notes](https://github.com/smol-rs/futures-lite/releases)
- [Changelog](https://github.com/smol-rs/futures-lite/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/futures-lite/compare/v1.12.0...v2.0.0)

---
updated-dependencies:
- dependency-name: futures-lite
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-31 02:17:33 +09:00
John Nunley ca654755ac
v3.0.1
Signed-off-by: John Nunley <dev@notgull.net>
2023-10-28 18:57:22 -07:00
Irine 74e82311c9
m: Update fmt::Debug to produce new info
Co-authored-by: John Nunley <dev@notgull.net>
2023-10-22 07:56:56 -07:00
Zeeshan Ali Khan e8a1727280
Merge pull request #90 from smol-rs/notgull/new-docs
Document that EventListeners must be listen'd on
2023-10-19 12:49:49 +02:00
John Nunley 5c1124135b
Fix doctest and nitpick
Signed-off-by: John Nunley <dev@notgull.net>
2023-10-18 08:35:13 -07:00
John Nunley ac3978ebb4
docs: Document that EventListeners must be listen'd on
In retrospect it is sometimes unclear in the documentation that the new event
listener needs to be pinned and inserted into the list before it can receive
events. This PR adds documentation that should clarify this issue.

Closes #89

Signed-off-by: John Nunley <dev@notgull.net>
2023-10-17 21:39:08 -07:00
Taiki Endo ccd2dfe873
Migrate to Rust 2021 (#85) 2023-10-13 10:36:17 +09:00
John Nunley 10bae60266
tests: Fix MIRI test errors
Signed-off-by: John Nunley <dev@notgull.net>
2023-10-12 16:41:11 -07:00
John Nunley d2ed2cdbf2
v3.0.0
Signed-off-by: John Nunley <dev@notgull.net>
2023-09-10 11:45:06 -07:00
Taiki Endo 7bbabd02f5
Relax memory ordering in AtomicCell::replace (#83) 2023-09-10 23:49:32 +09:00
Taiki Endo 450942e773
Disable IntoNotification::tag with no_std (#81) 2023-09-10 23:49:15 +09:00
Taiki Endo 4965dddf8f
Remove extra comma from cfg (#82) 2023-09-10 22:56:05 +09:00
Taiki Endo d4c63e9e3c Update actions/checkout action to v4 2023-09-10 18:26:59 +09:00
John Nunley cbbe9aafba Move event-listener-strategy to its own repository
https://github.com/smol-rs/event-listener-strategy

Signed-off-by: John Nunley <dev@notgull.net>
2023-09-04 08:40:30 -07:00
John Nunley c278371cfb
feat: Add explicit web support
This commit adds WASM compilation support to this crate. The main thing
is that the wait() family of APIs are removed in WASM mode, as blocking
is not allowed in WASM.

In addition, tests are added to CI to support WASM.

Signed-off-by: John Nunley <dev@notgull.net>
2023-08-26 12:53:39 -07:00
John Nunley 85ca6d3feb
feat: Implement UnwindSafe on core
With the new MSRV, UnwindSafe is now in libcore.

Signed-off-by: John Nunley <dev@notgull.net>
2023-08-24 08:07:32 -07:00
John Nunley e408ccda10
bugfix: Tracking down a deadlock in async-channel
There was a deadlock where notifications would not get delivered for
listeners that were stuck in the fallback queue. There is an
optimization where the notification count is checked to see if the
notifications delivered by the user would make any impact on the
listener chain; if it wouldn't, then it isn't done at all. For no_std,
I've removed this optimization, as I doubt that it can be done
consistently due to the nature of the fallback queue.

During testing I also uncovered problems with the current implementation
of the fallback queue itself. I've replaced it with concurrent-queue for
now, as I doubt that a fully functioning queue wouldn't be trivial
enough to justify inlining it into event-listener itself. Unfortunately
it adds three additional dependencies to the tree of event-listener.

With this change, the async-channel tests pass consistently.

Signed-off-by: John Nunley <dev@notgull.net>
2023-08-19 08:36:34 -07:00