Share via


AbstractQueuedSynchronizer.TryAcquireSharedNanos(Int32, Int64) Method

Definition

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

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

Parameters

arg
Int32

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.AbstractQueuedSynchronizer.tryAcquireSharedNanos(int, 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