#include <CeresEngine/Foundation/Threading/AsyncLatch.hpp>
◆ AsyncLatch()
| CeresEngine::AsyncLatch::AsyncLatch |
( |
std::ptrdiff_t |
initialCount | ) |
|
|
inlinenoexcept |
Construct the latch with the specified initial count.
- Parameters
-
| initialCount | The initial count of the latch. The latch will become signalled once this->count_down() has been called initialCount times. The latch will be immediately signalled on construction if this parameter is zero or negative. |
◆ count_down()
| void CeresEngine::AsyncLatch::count_down |
( |
std::ptrdiff_t |
n = 1 | ) |
|
|
inlinenoexcept |
Decrement the count by n.
Any coroutines awaiting this latch will be resumed once the count reaches zero. ie. when this method has been called at least 'initialCount' times.
Any awaiting coroutines that are currently suspended waiting for the latch to become signalled will be resumed inside the last call to this method (ie. the call that decrements the count to zero).
- Parameters
-
| n | The amount to decrement the count by. |
◆ is_ready()
| bool CeresEngine::AsyncLatch::is_ready |
( |
| ) |
const |
|
inlinenoexcept |
Query if the latch has become signalled.
The latch is marked as signalled once the count reaches zero.
◆ operator co_await()
Allows the latch to be awaited within a coroutine.
If the latch is already signalled (ie. the count has been decremented to zero) then the awaiting coroutine will continue without suspending. Otherwise, the coroutine will suspend and will later be resumed inside a call to count_down().
◆ mCount
| Atomic<std::ptrdiff_t> CeresEngine::AsyncLatch::mCount |
|
private |
◆ mEvent
The documentation for this class was generated from the following file:
- /Users/Rogiel/Developer/CeresEngine/Engine/Sources/CeresEngine/Foundation/Threading/AsyncLatch.hpp