Udostępnij za pośrednictwem


ILock.Lock Method

Definition

Acquires the lock.

[Android.Runtime.Register("lock", "()V", "GetLockHandler:Java.Util.Concurrent.Locks.ILockInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void Lock ();
[<Android.Runtime.Register("lock", "()V", "GetLockHandler:Java.Util.Concurrent.Locks.ILockInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member Lock : unit -> unit
Attributes

Remarks

Acquires the lock.

If the lock is not available then the current thread becomes disabled for thread scheduling purposes and lies dormant until the lock has been acquired.

<b>Implementation Considerations</b>

A Lock implementation may be able to detect erroneous use of the lock, such as an invocation that would cause deadlock, and may throw an (unchecked) exception in such circumstances. The circumstances and the exception type must be documented by that Lock implementation.

Java documentation for java.util.concurrent.locks.Lock.lock().

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