Initializer Constructor.
Size of the downward counter.
Decrements the counter and waits until the counter to be zero.
Decrements the counter by n and blocks the section until internal counter to be zero.
If the parametric value n is equal to or greater than internal counter, so that the internal counter be equal to or less than zero, everyone who are waiting for the Latch would continue their execution including this one.
Value of the decrement. Default is 1.
Derecements the counter.
Decrements the counter by n without blocking.
If the parametric value n is equal to or greater than internal counter, so that the internal counter be equal to or less than zero, everyone who are waiting for the Latch would continue their execution.
Value of the decrement. Default is 1.
Test whether the counter has been reached to the zero.
The try_wait function tests whether the internal counter has been reached to the zero.
Whether reached to zero or not.
Waits until the counter to be zero.
Blocks the function calling until internal counter to be reached to the zero.
If the Latch already has been reached to the zero, it would be returned immediately.
Tries to wait until the counter to be zero in timeout.
Attempts to block the function calling until internal counter to be reached to the zero
in timeout. If succeeded to waiting the counter to be reached to the zero, it returns
true
. Otherwise, the Latch fails to reach to the zero in the given time, the
function gives up the waiting and returns false
.
If the Latch already has been reached to the zero, it would return true
directly.
The maximum miliseconds for waiting.
Whether succeeded to waiting in the given time.
Tries to wait until the counter to be zero in time expiration.
Attempts to block the function calling until internal counter to be reached to the zero
in time expiration. If succeeded to waiting the counter to be reached to the zero, it
returns true
. Otherwise, the Latch fails to reach to the zero in the given time,
the function gives up the waiting and returns false
.
If the Latch already has been reached to the zero, it would return true
directly.
The maximum time point to wait.
Whether succeeded to waiting in the given time.
Generated using TypeDoc
Latch for critical sections.
The
Latch
class blocks critical sections until the downward counter to be zero. Howver, unlike Barrier who can reusable that downward counter be reset whenever reach to the zero, downward of theLatch
is not reusable but diposable.Jeongho Nam - https://github.com/samchon