AbstractQueuedLongSynchronizer.TryAcquireShared(Int64) Method

Definition

Attempts to acquire in shared mode.

[Android.Runtime.Register("tryAcquireShared", "(J)J", "GetTryAcquireShared_JHandler")]
protected virtual long TryAcquireShared (long arg);
[<Android.Runtime.Register("tryAcquireShared", "(J)J", "GetTryAcquireShared_JHandler")>]
abstract member TryAcquireShared : int64 -> int64
override this.TryAcquireShared : int64 -> int64

Parameters

arg
Int64

the acquire argument. This value is always the one passed to an acquire method, or is the value saved on entry to a condition wait. The value is otherwise uninterpreted and can represent anything you like.

Returns

Int64

a negative value on failure; zero if acquisition in shared mode succeeded but no subsequent shared-mode acquire can succeed; and a positive value if acquisition in shared mode succeeded and subsequent shared-mode acquires might also succeed, in which case a subsequent waiting thread must check availability. (Support for three different return values enables this method to be used in contexts where acquires only sometimes act exclusively.) Upon success, this object has been acquired.

Attributes

Exceptions

if acquiring would place this synchronizer in an illegal state. This exception must be thrown in a consistent fashion for synchronization to work correctly.

if shared mode is not supported

Remarks

Java documentation for java.util.concurrent.locks.AbstractQueuedLongSynchronizer.tryAcquireShared(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