Expand description
§Async Priority Lock
Primitives for priority-sorted synchronization of resources.
Permits / lock guards are granted in order of priority, with the option to request
eviction when the evict flag is enabled.
All Futures are cancel-safe.
§Feature flags:
| Feature | Default | Description |
|---|---|---|
evict | ❌ | Enables eviction for Semaphore and Mutex. |
semaphore-total | ❌ | Enables Semaphore::total_permits and Semaphore::acquire_within_total. |
serde | ❌ | Implement serde::Deserialize for Mutex + builtin Priority structs. |
box-queue | ❌ | Enables queue::boxed. |
arena-queue | ✅ | Enables queue::arena. |
const-default | ✅ | Implement const_default::ConstDefault for Mutex and Semaphore. Also enables const_new fns. |
mutex | ✅ | Enable Mutex. |
semaphore | ✅ | Enable Semaphore. |
std | ✅ | Enables use of std (disable for no_std envs. note if disabled, spin must be enabled). |
alloc | ✅ | Enables use of alloc crate. Always required for box-queue and arena-queue. |
spin | ❌ | Use spin for internal locks (note: spin won’t be used if std flag is enabled). |
Interrupt / signal safety: operations affecting the internal queues (such as locking or releasing) are not safe to call in parallel on the same thread.
i.e.: a deadlock may occur if the acquisition or dropping of a guard is interrupted, and the same thread goes on to acquire or drop a guard from the same Mutex / Semaphore.
If this is non-desireable / will cause issues, feel free to create an issue.
§Changelog
§v1.0.2
- fix typo in feature table
- relaxed
Sizedbound onMutexT
§v1.0.1
- fix typo in README.md example
- fix
Defaultimpl forSemaphore
§v1.0.0
- Added
PriorityandPriorityQueuetraits - Renamed
PriorityMutex->Mutexand rewrote to usePriorityandPriorityQueuetraits. - Added
Semaphore - Added changelog
Re-exports§
Modules§
- mutex
- Contains the Mutex type for async, priority-ordered exclusive access to a resource.
- priority
- Contains the Priority trait responsible for establishing entry position in PriorityQueue.
- queue
- Contains the PriorityQueue trait and builtin impls when features are enabled.
- semaphore
- Contains the Semaphore struct for async, priority-ordered acquisition of permits.