Commit Graph

198 Commits

Author SHA1 Message Date
John Nunley 564b84b416
m: Remove tag support from no_std
For tagging to work under no-std mode, the tags would need to be stored
in the backup queue. For notifications for std::usize::MAX listeners,
this is not possible. Therefore the only strategy left to use that doesn't
massively constrain the use of tagging is to remove tags from no_std
mode.

Closes #73

Signed-off-by: John Nunley <dev@notgull.net>
2023-08-17 14:13:51 -07:00
John Nunley 1c95cd2eec
bugfix: Fix a couple of bugs in the no_std implementation
- Prevent a panic for when the task has already been taken in the node
- Fix a null pointer dereference in the backup queue

Signed-off-by: John Nunley <dev@notgull.net>
2023-08-17 08:36:29 -07:00
Taiki Endo 7ce2634cb5
bugfix: Use inline assembly in full_fence
Bumps the MSRV to 1.59
2023-08-13 14:31:59 -07:00
Taiki Endo 8c55219847
Update CI config (#72)
- Test i686
- Test no_std module with Miri
- Test with release mode
2023-08-14 01:58:05 +09:00
Taiki Endo 0ea464102e
m: Remove most of Pin API related unsafe code
- Use Option::as_pin_mut/Pin::set
- Use pin-project-lite
2023-08-09 12:27:09 -07:00
Taiki Endo a1c3570ede
docs: Fix typos 2023-08-09 12:22:36 -07:00
Taiki Endo 779b3913e2
Update minimal version of pin-project-lite to 0.2.12 (#66) 2023-08-10 01:01:19 +09:00
John Nunley 6b6644a557
feat: Add an is_listening() method to the event listener
This allows users to determine if the listener is registered without needing to keep track of external state.

Signed-off-by: John Nunley <dev@notgull.net>
2023-08-06 14:41:28 -07:00
John Nunley 7c42a41290
Add smol-rs logo (#63) 2023-07-17 14:41:30 +09:00
John Nunley 518053257b
Add a poll_with_strategy method to easy_wrapper! (#60) 2023-05-26 19:52:38 -07:00
John Nunley d6065ed8cb
Make sure Event/EventListener are Send/Sync (#59)
Necessary to resolve failing tests in smol-rs/async-channel#59
2023-05-22 18:28:02 -07:00
John Nunley 5380454c47
Merge pull request #57 from smol-rs/notgull/notify-ret-count 2023-05-20 11:44:07 -07:00
jtnunley e2e89d2d55
Add documentation of new functionality 2023-05-20 11:33:19 -07:00
jtnunley 6345794547 Make the notify() function return notified count
Fix off-by-one error in implementation
2023-05-17 15:12:13 -07:00
John Nunley fb90f08f64
Add support for generic types to easy_wrapper (#54) 2023-05-17 14:03:46 -07:00
John Nunley 6d2a09741c
feat: Add an "is_notified" function (#48) 2023-05-14 10:28:18 -07:00
John Nunley 38f6e7c8b2
Merge pull request #52 from smol-rs/notgull/tagged-events-2 2023-05-13 15:33:05 -07:00
jtnunley 92750544c4
Replace boxed closure with a vec of tags
This should hopefully reduce the amount of allocation on the cold no_std
path
2023-05-10 10:06:41 -07:00
Taiki Endo 97865d16b8 Minimize GITHUB_TOKEN permissions
Refs: https://github.blog/changelog/2021-04-20-github-actions-control-permissions-for-github_token
2023-04-30 06:05:18 +09:00
Taiki Endo 43950ee259 Set CARGO_NET_GIT_FETCH_WITH_CLI=true in CI 2023-04-30 06:05:18 +09:00
John Nunley 0749ab44f6
Remove the pin-utils dependency (#56) 2023-04-28 13:52:18 -07:00
jtnunley a8c3aa76c2 Wire up the Strategy trait with the new tags 2023-04-05 09:29:31 -07:00
John Nunley a7e74b256d Fix doctests 2023-04-04 16:05:49 -07:00
John Nunley 15b4ea27ff Seal the Notification and IntoNotification traits
This PR seals these two traits to prevent breaking changes from causing
semver breaks. It also adds documentation to both traits.
2023-04-04 15:49:43 -07:00
jtnunley 723c3282bb Fix various CI errors
Fixes the following issues:

- Failed to build on MSRV due to Unpin bound
- Failed to build on no_std, as I didn't import Box
- Failed to build on portable-atomic, as Arc didn't implement Unpin
2023-04-04 09:44:23 -07:00
jtnunley e001c7a0c8 Add a type parameter T to Event
Sets up tagged events to use the Notification trait.
2023-04-03 07:37:26 -07:00
jtnunley 266b60d2b1 Change out SingleNotify for GenericNotify 2023-04-03 07:35:52 -07:00
jtnunley 5f67dd0cff Adjust the Notification logic slightly
I missed that this is needed for notification propogation.
2023-04-03 07:35:52 -07:00
jtnunley d986a5c9c3 Add the Notification trait
This will be used to replace the notify_* family of functions.
2023-04-03 07:35:52 -07:00
John Nunley e909945dcb
Add a portable-atomic feature (#53) 2023-04-02 21:36:44 -07:00
Alain Zscheile a9595d3525
Merge pull request #51 from smol-rs/notgull/rework-int-list
feat: Rework the internal structure of the event-listener crate
2023-04-02 21:09:01 +02:00
notgull 72bfe0733b Review comments 2023-04-02 11:24:24 -07:00
jtnunley 8208309a6d Forgot to adjust length in remove() 2023-03-31 14:04:55 -07:00
jtnunley 17952d648e Fix code review/CI issues 2023-03-31 13:58:16 -07:00
jtnunley bc07d43403 Avoid allocation in the benchmarks 2023-03-31 13:43:53 -07:00
John Nunley 2ac3be011e Build tests for no-default-features into C/I 2023-03-31 13:43:09 -07:00
jtnunley 1ec136a8a5 Unsplit the 'Incomplete' commit 2023-03-31 13:42:55 -07:00
jtnunley 3fefa6cd46 Fix tests
- Adds the unit test set to the no_std implementation
- Fixes doc tests in event-listener-strategy
2023-03-31 13:32:26 -07:00
jtnunley 20c69a16b5 Add a libstd implementation of the inner list
This implementation is around 20% faster than the no_std one, according
to benchmarks. Therefore, we should use it where we can.
2023-03-31 13:24:20 -07:00
jtnunley 996ee4d4f9 EventListener is now used through pinning
The EventListener for the upcoming libstd-based implementation needs to
be pinned, so this commit sets up the infrastructure for the pinned
EventListener.

This is a breaking change.
2023-03-31 13:19:06 -07:00
jtnunley c659cf84f3 Use a cached Parker/Unparker pair when possible
This optimization is inspired by what futures_lite does for the block_on
function. This should prevent users from dealing with the overhead of
creating a parker and unparker every time wait() is called.
2023-03-31 13:04:03 -07:00
jtnunley 09ded13214 Replace Listener with Option<sys::Listener> 2023-03-31 12:59:47 -07:00
jtnunley de1f13a698 Split the EventListener struct into a sub-listener structure
First part of EventListener reworks. The idea here is that, in the
future, we can add an "EventListenerRef" structure that just takes
an "&'a Inner" rather than an "Arc<Inner>". This way, you don't
need to do an atomic clone for listening.
2023-03-31 11:46:30 -07:00
jtnunley 0c76968d23 High-level module reorganization
- Renames "list.rs" and the "list" folder to "no_std"
- Uses `no_std` as the `sys` module in preparation for the `std` module
- Inlines `sync.rs` into `lib.rs`
2023-03-31 11:29:39 -07:00
jtnunley 5c83b86b90 Remove the `crossbeam-utils` dependency
Everything from that crate can either be inlined or ignored.

I also fix a bug with the list implementation as well.
2023-03-31 11:24:37 -07:00
jtnunley 1188962f0c Remove the `slab` dependency
Ideally, we should have as few dependencies as possible. This change
inlines most of the logic from `slab` that we used into the
`ListenerSlab` struct.
2023-03-31 11:18:57 -07:00
jtnunley 393566ada7 Move node.rs and queue.rs to be submodules of list.rs
This move abstracts them to be a sub-module of the inner list.
2023-03-31 11:09:46 -07:00
jtnunley 2d171aed47 Move the lock method to list.rs and rename it to try_lock 2023-03-31 11:06:39 -07:00
jtnunley 1a4df186e4 Trim unnecessary abstractions 2023-03-31 11:02:56 -07:00
jtnunley be047ad75c Move listener data into list.rs 2023-03-31 10:52:43 -07:00