ICountDownLatchAwait Method Hazelcast .Net Client Class Library
Causes the current thread to wait until the latch has counted down to zero, an exception is thrown, or the specified waiting time elapses.

Namespace: Hazelcast.Core
Assembly: Hazelcast.Net (in Hazelcast.Net.dll) Version: 3.7.1
Syntax

bool Await(
	long timeout,
	TimeUnit unit
)

Parameters

timeout
Type: SystemInt64
the maximum time to wait
unit
Type: Hazelcast.CoreTimeUnit
the time unit of the
timeout
argument

Return Value

Type: Boolean
true
if the count reached zero and
false
if the waiting time elapsed before the count reached zero
Exceptions

ExceptionCondition
Exceptionif the current thread is interrupted
InvalidOperationExceptionif hazelcast instance is shutdown while waiting
Remarks

Causes the current thread to wait until the latch has counted down to zero, an exception is thrown, or the specified waiting time elapses.

If the current count is zero then this method returns immediately with the value

true
.

If the current count is greater than zero then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of five things happen:

  • The count reaches zero due to invocations of the CountDown() method;
  • This ICountDownLatch instance is destroyed;
  • The countdown owner becomes disconnected;
  • Some other thread the current thread; or
  • The specified waiting time elapses.

If the count reaches zero then the method returns with the value

true
.

If the current thread:

  • has its interrupted status set on entry to this method; or
  • is while waiting,
then System.Exception is thrown and the current thread's interrupted status is cleared.

If the specified waiting time elapses then the value

false
is returned. If the time is less than or equal to zero, the method will not wait at all.

See Also

Reference