Skip to content

v3.2.0 — Extend synchronization suite with AsyncSemaphore, AsyncEvent, WaitGroup, and Cancellation primitives

Choose a tag to compare

@g2px1 g2px1 released this 06 Nov 10:03
· 124 commits to main since this release

Changes:

  • Added usub::uvent::sync::AsyncSemaphore — coroutine-based counting semaphore for bounded parallelism and resource pooling.

    • Supports co_await sem.acquire(), try_acquire(), and release(k) without blocking threads.
    • Lock-free design using atomic counters and waiter stacks.
  • Added usub::uvent::sync::AsyncEvent — coroutine-aware signaling primitive with Reset::Auto (wake one) and Reset::Manual (wake all) modes.

    • Allows efficient coroutine coordination without busy-waiting or polling.
    • Compatible with co_await event.wait(), set(), and reset().
  • Added usub::uvent::sync::WaitGroup — coroutine barrier similar to Go’s sync.WaitGroup.

    • Supports add(n), done(), and co_await wg.wait() for group completion synchronization.
    • All waiters resume cooperatively through the event-loop queue.
  • Added usub::uvent::sync::CancellationSource and CancellationToken for cooperative coroutine cancellation.

    • Enables graceful termination of async tasks and timeouts.
    • All registered waiters (on_cancel()) are resumed instantly on request_cancel().
  • Unified documentation:

    • New page docs/synchronization.md covering all primitives (AsyncMutex, AsyncSemaphore, AsyncEvent, WaitGroup, Cancellation).
    • Each section includes design overview, example, API reference, and performance metrics.
  • Minor runtime adjustments to internal system::this_thread::detail::q scheduling for improved coroutine resumption fairness under contention.

This release completes the coroutine-native synchronization layer for Uvent, providing a full set of non-blocking primitives for safe and efficient coordination inside the event-driven runtime.