ISemaphoreAcquire Method (Int32)Hazelcast .Net Client Class Library
Acquires the given number of permits, if they are available, and returns immediately, reducing the number of available permits by the given amount.

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

void Acquire(
	int permits
)

Parameters

permits
Type: SystemInt32
the number of permits to acquire
Exceptions

ExceptionCondition
ArgumentException if permits is negative
InvalidOperationExceptionif hazelcast instance is shutdown while waiting
Remarks

Acquires the given number of permits, if they are available, and returns immediately, reducing the number of available permits by the given amount.

If insufficient permits are available then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of two things happens:

  • Some other thread invokes one of the release methods for this semaphore, the current thread is next to be assigned permits and the number of available permits satisfies this request;
  • This ISemaphore instance is destroyed;
See Also

Reference