Commit Graph

47 Commits

Author SHA1 Message Date
John Nunley 542831132f
Replace async-channel with flume
This commit replaces async-channel in some tests with flume. It appears
that async-channel doesn't work under MIRI but flume does, so we can
work around this for now by replacing it with flume.

cc https://github.com/smol-rs/async-channel/issues/85

Signed-off-by: John Nunley <dev@notgull.net>
2024-04-08 14:10:39 -07:00
John Nunley df82e5bb5e chore: Silence clippy
Signed-off-by: John Nunley <dev@notgull.net>
2024-04-08 11:01:15 -07:00
John Nunley ff4c96fe4d
m: Port to event-listener v5.0.0
cc smol-rs/event-listener#105

Signed-off-by: John Nunley <dev@notgull.net>
2024-02-12 06:27:42 -08:00
Harry Barber 3e855f55f0
feat: add `forget` method to semaphore guards (#73)
Co-authored-by: Jules Bertholet <julesbertholet@quoi.xyz>
2023-12-11 00:29:25 -05:00
Jules Bertholet d1cff639d8
Add missing `Arc` blocking methods (#71)
* Add missing `Arc` blocking methods

Adds:

- `Rwlock::read_arc_blocking`
- `RwLock::upgradable_read_arc_blocking`
- `RwLock::write_arc_blocking`
- `RwLockUpgradableReadGuardArc::upgrade_blocking`
- `Semaphore::acquire_arc_blocking`

* Restore missing future `fmt::Debug` impls
2023-11-25 22:19:13 -05:00
dependabot[bot] d333a41c1d
Update event-listener requirement from 3.0.0 to 4.0.0 (#69)
* Update event-listener requirement from 3.0.0 to 4.0.0

Updates the requirements on [event-listener](https://github.com/smol-rs/event-listener) to permit the latest version.
- [Release notes](https://github.com/smol-rs/event-listener/releases)
- [Changelog](https://github.com/smol-rs/event-listener/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/event-listener/compare/v3.0.0...v4.0.0)

---
updated-dependencies:
- dependency-name: event-listener
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update `event-listener-strategy` to 0.4.0

* Adjust `EventListener::new` and `listen` calls

* Appease rustc 173b950

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jules Bertholet <julesbertholet@quoi.xyz>
2023-11-21 00:54:32 -05:00
Jules Bertholet b9aa29483f Fix broken links in docs 2023-11-16 18:41:27 -08:00
John Nunley 48c091ef3b
docs: Add a note comparing against std types
Signed-off-by: John Nunley <dev@notgull.net>
Co-authored-by: Jules Bertholet <julesbertholet@quoi.xyz>
2023-11-13 18:42:26 -08:00
Jules Bertholet 902e8f9229
Implement `Default` for `OnceCell` (#63) 2023-11-08 11:01:15 -05:00
John Nunley 604d461172
feat: Support blocking and non-blocking operations on the same mutex
Signed-off-by: John Nunley <dev@notgull.net>
2023-09-22 20:12:23 -07:00
John Nunley 3a82590a69 Add a default "std" feature for no_std usage
This is a breaking change for no-default-features users.

Signed-off-by: John Nunley <dev@notgull.net>
2023-09-17 07:58:04 -07:00
jtnunley 8f8b4fea18 Bump to event-listener v3.0.0
The new version of event-listener comes with several new changes, including less
heap allocation and no_std support.

This is a breaking change as it makes a handful of futures !Unpin.

Signed-off-by: John Nunley <dev@notgull.net>
2023-09-17 07:57:33 -07:00
John Nunley 8045684f99
Add smol-rs logo (#52) 2023-07-17 14:40:02 +09:00
Pierre Krieger 65b6cb97c4
bugfix: Replace `target_os = "wasm64"` with `target_arch = "wasm64"` 2023-07-13 06:58:44 -07:00
Jules Bertholet 0b7252c71f
Fix UB in `MutexGuardArc::source` (#50)
The alternative would be to change the `Sync` impl for  `MutexGuardArc`
to require `T: Send + Sync`.
2023-07-08 01:21:20 +09:00
Jules Bertholet d22ee4e63c
Loosen `Send`/`Sync` bounds on `Mutex` and `RwLock` futures (#48) 2023-06-14 18:06:05 -07:00
Jules Bertholet 936e046e5a
feat: Add reference-counted versions of `RwLock` guards (#47)
Adds reference-counted versions of `RwLock` guards to #33.
2023-06-13 21:18:11 -07:00
Jules Bertholet 90b1a30f39
fix: Fix deadlock introduced in 0b71083 2023-05-28 18:16:42 -07:00
Jules Bertholet 0b71083fc2
chore: Make `RwLockReadGuard` covariant (#45)
Closes #9 by making the RwLockReadGuard type covariant.

This involves splitting the RwLock implementation into a "raw" RwLock part and the public API.
2023-05-26 21:35:29 -07:00
Jules Bertholet 99a44a5b45
feature: Add Semaphore::add_permits()
This function allows increasing the permit count after creation.
2023-05-26 19:39:40 -07:00
SNCPlay42 6bac58a9c9
fix: don't busy wait in SemaphoreGuard::acquire_arc (#42)
Closes #41 by fixing buggy waiting code.
2023-05-26 17:55:24 -07:00
John Nunley f738cfd068
Use pin macro instead of new_unchecked (#40)
Addresses concerns that the variable was not being properly pinned.
2023-04-30 12:53:23 -07:00
Caio 39e0b6dc75
Mark `MutexGuard` with `#[clippy::has_significant_drop]` (#37)
* Mark `MutexGuard` with `#[clippy::has_significant_drop]`

`#[clippy::has_significant_drop]` tells that a structure should be considered when evaluating some lints. Examples of such behavior are the existent `clippy::significant_drop_in_scrutinee` and in the soon-to-be-finished https://github.com/rust-lang/rust-clippy/issues/9399.

* Include more structures
2023-02-03 15:04:57 -08:00
John Nunley 350cda03d9
m: Remove futures-lite dependency (#36) 2023-01-26 14:13:16 -08:00
John Nunley 15049aa1c9
Replace some async blocks with manual futures (#34)
* Replace some async blocks with manual futures

* Fix WASM build

* Use a slightly more idiomatic way to access event listeners

* Fix MIRI failure

* Code review
2022-12-28 20:30:48 -08:00
Taiki Endo 465e0e2340
Do not copy data before dropping (#28) 2022-10-25 22:38:24 +09:00
Taiki Endo 5f80166270 Simplify wasm tests 2022-10-25 21:59:55 +09:00
John Nunley 05fed2a1e8
Add a OnceCell type (#27) 2022-08-28 08:03:56 -07:00
Taiki Endo ab4362fe81 Support wasm64 2022-07-27 11:46:08 +09:00
Taiki Endo 48a5b6220e Fix semaphore lifetime issue as well 2022-02-19 19:32:16 +09:00
Rafael Ávila de Espíndola 9a92efd50d Simplify using lock_arc
The future returned by lock_arc would already resolve to a
MutexGuardArc that kept the Arc<Mutex> alive. Unfortunately, sometimes
one needs to store the future itself, not the MutexGuardArc and the
future had a reference to the Arc<Mutex>.

With this patch, the future itself also has a Arc<Mutex>.
2022-01-26 17:01:39 -05:00
Zicklag 44e8c9b434 Add WASM Support 2021-04-15 11:22:37 -05:00
Taiki Endo 875dc41cd5 Replace deprecated compare_and_swap with compare_exchange 2020-12-24 21:22:11 +09:00
Stjepan Glavina d55e6bdd60 Merge all crates 2020-10-08 14:43:15 +02:00
Stjepan Glavina 70de794cf7 Bump to v2.1.3 2020-09-16 00:21:45 +02:00
Stjepan Glavina f6af6a912b Bump to v2.1.1 2020-08-29 15:19:32 +02:00
Stjepan Glavina f9b304d3db Add semaphore and barrier 2020-08-29 15:14:57 +02:00
Stjepan Glavina 1962cf1bb4 Bump to v2.0.0 2020-08-26 23:44:19 +02:00
Stjepan Glavina 03dd9fd1e6 Implement using async-mutex 2020-08-20 13:21:14 +00:00
Stjepan Glavina 9cc179e0e5 Bump to v1.1.4 2020-06-24 02:24:48 +02:00
Stjepan Glavina 15e49772ab Bump to v1.1.3 2020-06-24 01:44:53 +02:00
Stjepan Glavina 30e46155c7 Typo 2020-05-28 09:21:29 +02:00
Stjepan Glavina 2ceca7d661 Fix a deadlock issue 2020-05-27 01:04:56 +02:00
Stjepan Glavina 22d59d399f Typos 2020-05-25 22:35:05 +02:00
Stjepan Glavina d4bf926114 Bump to v1.1.0 2020-05-25 22:04:39 +02:00
Stjepan Glavina 487ead1909 Add LockGuard::source() 2020-05-25 21:51:22 +02:00
Stjepan Glavina dc66c0665e Initial commit 2020-05-17 17:41:54 +02:00