Java.Util.Concurrent.Semaphore Members

The members of Java.Util.Concurrent.Semaphore are listed below.

See Also: Inherited members from Java.Lang.Object

Public Constructors

Creates a Semaphore with the given number of permits and nonfair fairness setting.
Creates a Semaphore with the given number of permits and the given fairness setting.

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Properties

[read-only]
HasQueuedThreadsbool. Queries whether any threads are waiting to acquire.
[read-only]
IsFairbool. Returns true if this semaphore has fairness set true.
[read-only]
QueueLengthint. Returns an estimate of the number of threads waiting to acquire.

Protected Properties

[read-only]
QueuedThreadsICollection<Java.Lang.Thread>. Returns a collection containing threads that may be waiting to acquire.
[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

Acquire()
Acquires a permit from this semaphore, blocking until one is available, or the thread is Java.Lang.Thread.Interrupt.
Acquire(int)
Acquires the given number of permits from this semaphore, blocking until all are available, or the thread is Java.Lang.Thread.Interrupt.
AcquireUninterruptibly()
Acquires a permit from this semaphore, blocking until one is available.
AcquireUninterruptibly(int)
Acquires the given number of permits from this semaphore, blocking until all are available.
AvailablePermits() : int
Returns the current number of permits available in this semaphore.
DrainPermits() : int
Acquires and returns all permits that are immediately available.
Release()
Releases a permit, returning it to the semaphore.
Release(int)
Releases the given number of permits, returning them to the semaphore.
TryAcquire() : bool
Acquires a permit from this semaphore, only if one is available at the time of invocation.
TryAcquire(int) : bool
Acquires the given number of permits from this semaphore, only if all are available at the time of invocation.
TryAcquire(long, TimeUnit) : bool
Acquires a permit from this semaphore, if one becomes available within the given waiting time and the current thread has not been Java.Lang.Thread.Interrupt.
TryAcquire(int, long, TimeUnit) : bool
Acquires the given number of permits from this semaphore, if all become available within the given waiting time and the current thread has not been Java.Lang.Thread.Interrupt.

Protected Methods

ReducePermits(int)
Shrinks the number of available permits by the indicated reduction.