ISemaphore is a backed-up distributed alternative to the
System.Threading.Semaphore
.
Namespace: Hazelcast.Core
Assembly: Hazelcast.Net (in Hazelcast.Net.dll) Version: 3.9.1
Syntax
The ISemaphore type exposes the following members.
Methods
Name | Description | |
---|---|---|
Acquire |
Acquires a permit, if one is available and returns immediately,
reducing the number of available permits by one.
| |
Acquire(Int32) |
Acquires the given number of permits, if they are available,
and returns immediately, reducing the number of available permits
by the given amount.
| |
AvailablePermits | Returns the current number of permits currently available in this semaphore. | |
Destroy | Destroys this object cluster-wide. (Inherited from IDistributedObject.) | |
DrainPermits | Acquires and returns all permits that are immediately available. | |
GetName | Returns the unique name for this IDistributedObject. (Inherited from IDistributedObject.) | |
GetPartitionKey | Returns the key of partition this IDistributedObject is assigned to. (Inherited from IDistributedObject.) | |
GetServiceName | Returns the service name for this object. (Inherited from IDistributedObject.) | |
Init | Try to initialize this ISemaphore instance with given permit count | |
ReducePermits |
Shrinks the number of available permits by the indicated
reduction.
| |
Release |
Releases a permit, increasing the number of available permits by
one.
| |
Release(Int32) |
Releases the given number of permits, increasing the number of
available permits by that amount.
| |
TryAcquire |
Acquires a permit, if one is available and returns immediately,
with the value true, reducing the number of available permits by one.
| |
TryAcquire(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.
| |
TryAcquire(Int64, TimeUnit) |
Acquires a permit from this semaphore, if one becomes available
within the given waiting time and the current thread has not
been interrupted.
| |
TryAcquire(Int32, Int64, TimeUnit) |
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.
|
Remarks
- Correct usage of a semaphore is established by programming convention in the application.
See Also