AbstractQueuedLongSynchronizer.TryAcquireSharedNanos(Int64, Int64) Method

Definition

Attempts to acquire in shared mode, aborting if interrupted, and failing if the given timeout elapses.

[Android.Runtime.Register("tryAcquireSharedNanos", "(JJ)Z", "")]
public bool TryAcquireSharedNanos (long arg, long nanosTimeout);
[<Android.Runtime.Register("tryAcquireSharedNanos", "(JJ)Z", "")>]
member this.TryAcquireSharedNanos : int64 * int64 -> bool

Parameters

arg
Int64

the acquire argument. This value is conveyed to #tryAcquireShared but is otherwise uninterpreted and can represent anything you like.

nanosTimeout
Int64

the maximum number of nanoseconds to wait

Returns

true if acquired; false if timed out

Attributes

Exceptions

if the current thread is interrupted

Remarks

Attempts to acquire in shared mode, aborting if interrupted, and failing if the given timeout elapses. Implemented by first checking interrupt status, then invoking at least once #tryAcquireShared, returning on success. Otherwise, the thread is queued, possibly repeatedly blocking and unblocking, invoking #tryAcquireShared until success or the thread is interrupted or the timeout elapses.

Java documentation for java.util.concurrent.locks.AbstractQueuedLongSynchronizer.tryAcquireSharedNanos(long, long).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to