Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.

### New features

* Add an opt-in runtime-agnostic `Phaser` with shared observer handles, dynamic RAII participants registered individually or in batches through an owning iterator, `u64` phase numbers, split arrival/wait with cancellation-resilient retries, and a `close` operation that releases unfinished waits with `Closed`.
* Add bounded MPSC `reserve` and `try_reserve` methods returning a `Permit`, allowing callers to wait for capacity before constructing a message; pending sends and reservations receive capacity in wait-queue order, and unused permits release capacity without claiming message order.

### Bug fixes
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Runnable examples live in the [`examples`](examples) workspace crate. They demon
| | [`Barrier`](https://docs.rs/asyncband/*/asyncband/barrier/struct.Barrier.html) | `barrier` | Synchronize a fixed number of participants at a reusable rendezvous. |
| | [`ManualResetEvent`](https://docs.rs/asyncband/*/asyncband/event/struct.ManualResetEvent.html) | `event` | Signal current and future waits until explicitly reset. |
| | [`Latch`](https://docs.rs/asyncband/*/asyncband/latch/struct.Latch.html) | `latch` | Wait until a fixed one-way countdown reaches zero. |
| | [`Phaser`](https://docs.rs/asyncband/*/asyncband/phaser/struct.Phaser.html) | `phaser` | Coordinate repeated phases with a dynamic participant set. |
| | [`WaitGroup`](https://docs.rs/asyncband/*/asyncband/waitgroup/struct.WaitGroup.html) | `waitgroup` | Dynamically register participants and wait until all have completed. |
| | [`Shutdown`](https://docs.rs/asyncband/*/asyncband/shutdown/struct.Shutdown.html) | `shutdown` | Request shutdown and wait until all completion guards are dropped. |
| Work coalescing | [`Once`](https://docs.rs/asyncband/*/asyncband/once/struct.Once.html) | `once` | Complete one asynchronous initialization; cancelled or panicked attempts may be retried. |
Expand Down
1 change: 1 addition & 0 deletions asyncband/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ once = ["semaphore"]
once-cell = ["semaphore"]
once-map = ["dep:hashbrown", "once-cell"]
oneshot = []
phaser = []
pool = ["semaphore"]
rwlock = []
semaphore = []
Expand Down
4 changes: 4 additions & 0 deletions asyncband/src/internal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pub(crate) fn wake_all(mut wakers: impl Iterator<Item = Waker>) {
feature = "latch",
feature = "mpsc",
feature = "mutex",
feature = "phaser",
feature = "rwlock",
feature = "semaphore",
feature = "waitgroup",
Expand Down Expand Up @@ -84,6 +85,7 @@ pub(crate) mod value_cell;
feature = "latch",
feature = "mpsc",
feature = "mutex",
feature = "phaser",
feature = "rwlock",
feature = "semaphore",
feature = "waitgroup",
Expand Down Expand Up @@ -120,6 +122,7 @@ pub(crate) mod waitlist;
feature = "mpsc",
feature = "mutex",
feature = "once",
feature = "phaser",
feature = "rwlock",
feature = "semaphore",
feature = "waitgroup",
Expand All @@ -136,6 +139,7 @@ pub(crate) mod waker_batch;
feature = "completion",
feature = "latch",
feature = "once",
feature = "phaser",
feature = "waitgroup",
feature = "watch",
))]
Expand Down
8 changes: 7 additions & 1 deletion asyncband/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
//! | | [`Barrier`](barrier::Barrier) | `barrier` | Synchronize a fixed number of participants at a reusable rendezvous. |
//! | | [`ManualResetEvent`](event::ManualResetEvent) | `event` | Signal current and future waits until explicitly reset. |
//! | | [`Latch`](latch::Latch) | `latch` | Wait until a fixed one-way countdown reaches zero. |
//! | | [`Phaser`](phaser::Phaser) | `phaser` | Coordinate repeated phases with a dynamic participant set. |
//! | | [`WaitGroup`](waitgroup::WaitGroup) | `waitgroup` | Dynamically register participants and wait until all have completed. |
//! | | [`Shutdown`](shutdown::Shutdown) | `shutdown` | Request shutdown and wait until all completion guards are dropped. |
//! | Work coalescing | [`Once`](once::Once) | `once` | Complete one asynchronous initialization; cancelled or panicked attempts may be retried. |
Expand Down Expand Up @@ -145,6 +146,8 @@ pub mod mutex;
pub mod once;
#[cfg(feature = "oneshot")]
pub mod oneshot;
#[cfg(feature = "phaser")]
pub mod phaser;
#[cfg(feature = "pool")]
pub mod pool;
#[cfg(feature = "rwlock")]
Expand All @@ -160,5 +163,8 @@ pub mod waitgroup;
#[cfg(feature = "watch")]
pub mod watch;

#[cfg(all(test, any(feature = "once-map", feature = "singleflight")))]
#[cfg(all(
test,
any(feature = "once-map", feature = "phaser", feature = "singleflight")
))]
mod test_support;
6 changes: 3 additions & 3 deletions asyncband/src/mutex/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
// Copyright (c) Tokio Contributors
// The Tokio-derived portions remain licensed under the MIT License.
// Asyncband independently built the mutex on its own semaphore and substantially changed the
// incorporated guard implementation: the try-lock error type and semaphore closure are absent,
// projected guards use NonNull pointers with explicit invariance, and projected guards can be
// mapped repeatedly in both borrowed and owned forms.
// incorporated guard implementation: the try-lock error type and support for closing the semaphore
// are absent, projected guards use NonNull pointers with explicit invariance, and projected guards
// can be mapped repeatedly in both borrowed and owned forms.
// Upstream source:
// https://github.com/tokio-rs/tokio/blob/01e04daaa162ce6122bb894fdda0b6803dd32093/tokio/src/sync/mutex.rs

Expand Down
Loading