Java.Util.Concurrent.Semaphore.TryAcquire Method
Acquires a permit from this semaphore, only if one is available at the time of invocation.

Syntax

[Android.Runtime.Register("tryAcquire", "()Z", "GetTryAcquireHandler")]
public virtual bool TryAcquire ()

Returns

Documentation for this section has not yet been entered.

Remarks

Acquires a permit from this semaphore, only if one is available at the time of invocation.

Acquires a permit, if one is available and returns immediately, with the value true, reducing the number of available permits by one.

If no permit is available then this method will return immediately with the value false.

Even when this semaphore has been set to use a fair ordering policy, a call to tryAcquire()will immediately acquire a permit if one is available, whether or not other threads are currently waiting. This "barging" behavior can be useful in certain circumstances, even though it breaks fairness. If you want to honor the fairness setting, then use Semaphore.TryAcquire(long, Java.Util.Concurrent.TimeUnit) which is almost equivalent (it also detects interruption).

[Android Documentation]

Requirements

Namespace: Java.Util.Concurrent
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1