Expand description
§Mea - Make Easy Async
mea
is a runtime-agnostic library providing essential synchronization primitives for
asynchronous Rust programming. The library offers a collection of well-tested, efficient
synchronization tools that work with any async runtime.
§Features
Barrier
: A synchronization point where multiple tasks can wait until all participants arriveCondvar
: A condition variable that allows tasks to wait for a notificationLatch
: A single-use barrier that allows one or more tasks to wait until a signal is givenMutex
: A mutual exclusion primitive for protecting shared dataRwLock
: A reader-writer lock that allows multiple readers or a single writer at a timeSemaphore
: A synchronization primitive that controls access to a shared resourceShutdownSend
&ShutdownRecv
: A composite synchronization primitive for managing shutdown signalsWaitGroup
: A synchronization primitive that allows waiting for multiple tasks to completeatomicbox
: A safe, owning version ofAtomicPtr
for heap-allocated data.mpsc::unbounded
: A multi-producer, single-consumer unbounded queue for sending values between asynchronous tasks.oneshot::channel
: A one-shot channel for sending a single value between tasks.
§Runtime Agnostic
All synchronization primitives in this library are runtime-agnostic, meaning they can be used with any async runtime like Tokio, async-std, or others. This makes the library highly versatile and portable.
§Thread Safety
All types in this library implement Send
and Sync
, making them safe to share across thread
boundaries. This is essential for concurrent programming where data needs to be accessed from
multiple threads.
Modules§
- atomicbox
AtomicBox
andAtomicOptionBox
are safe, owning versions of std’sAtomicPtr
.- barrier
- A synchronization primitive that enables multiple tasks to wait for each other.
- condvar
- A condition variable that allows tasks to wait for a notification.
- latch
- A countdown latch that allows one or more tasks to wait until a set of operations completes.
- mpsc
- A multi-producer, single-consumer queue for sending values between asynchronous tasks.
- mutex
- An async mutex for protecting shared data.
- oneshot
- A one-shot channel is used for sending a single message between
asynchronous tasks. The
channel
function is used to create aSender
andReceiver
handle pair that form the channel. - rwlock
- A reader-writer lock that allows multiple readers or a single writer at a time.
- semaphore
- An async counting semaphore for controlling access to a set of resources.
- shutdown
- A composite synchronization primitive for managing shutdown signals.
- waitgroup
- A synchronization primitive for waiting on multiple tasks to complete.