![](../icons/Hazelcast-IMDG-Logo-Orange_Dark_200px.jpg) | ISemaphoreTryAcquire Method (Int32) |
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.9.4
Syntaxbool TryAcquire(
int permits
)
Function TryAcquire (
permits As Integer
) As Boolean
bool TryAcquire(
int permits
)
abstract TryAcquire :
permits : int -> bool
Parameters
- permits
- Type: SystemInt32
the number of permits to acquire
Return Value
Type:
Booleantrue
if the permits were acquired and
false
otherwise
Exceptions
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