ISemaphoreTryAcquire Method (Int32)Hazelcast .Net Client Class Library
Acquires the given number of permits, if they are available, and returns immediately, with the value true, 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

bool TryAcquire(
	int permits
)

Parameters

permits
Type: SystemInt32
the number of permits to acquire

Return Value

Type: Boolean
true if the permits were acquired and false otherwise
Exceptions

ExceptionCondition
ArgumentException if permits is negative
Remarks

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

If insufficient permits are available then this method will return immediately with the value false and the number of available permits is unchanged.

See Also

Reference