#include <CeresEngine/Foundation/Threading/AsyncMutex.hpp>
◆ State
| Enumerator |
|---|
| Unlocked | |
| LockedShared | |
| LockedExclusive | |
◆ TAsyncSharedMutex() [1/4]
Creates a new async shared mutex.
◆ TAsyncSharedMutex() [2/4]
- Parameters
-
| executor | The executor for when multiple shared waiters can be woken up at the same time, each shared waiter will be scheduled to immediately run on this executor in parallel. |
◆ ~TAsyncSharedMutex()
◆ TAsyncSharedMutex() [3/4]
◆ TAsyncSharedMutex() [4/4]
◆ lock()
Locks the mutex in an exclusive state.
◆ lock_shared()
Locks the mutex in a shared state.
If there are any exclusive waiters then the shared waiters will also wait so the exclusive waiters are not starved.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ try_lock()
- Returns
- True if the lock could immediately be acquired in an exclusive state.
◆ try_lock_locked()
◆ try_lock_shared()
- Returns
- True if the lock could immediately be acquired in a shared state.
◆ try_lock_shared_locked()
◆ unlock()
Unlocks the mutex from its exclusive state.
If there is a following exclusive waiter then that exclusive waiter acquires the lock. If there are 1 or more shared waiters then all the shared waiters acquire the lock in a shared state in parallel and are resumed on the original thread pool this shared mutex was created with.
◆ unlock_shared()
Unlocks a single shared state user.
REQUIRES that the lock was first acquired exactly once via lock_shared() or try_lock_shared() before being called, otherwise undefined behavior.
If the shared user count drops to zero and this lock has an exclusive waiter then the exclusive waiter acquires the lock.
◆ wakeWaiters()
◆ LockOperation
◆ mExclusiveWaiters
The current number of exclusive waiters waiting to acquire the lock.
This is used to block new incoming shared lock attempts so the exclusive waiter is not starved.
◆ mExecutor
This executor is for resuming multiple shared waiters.
◆ mHeadWaiter
◆ mMutex
◆ mSharedUsers
The current number of shared users that have acquired the lock.
◆ mState
◆ mTailWaiter
The documentation for this class was generated from the following file:
- /Users/Rogiel/Developer/CeresEngine/Engine/Sources/CeresEngine/Foundation/Threading/AsyncMutex.hpp