다음을 통해 공유


ReentrantReadWriteLock.ReentrantWriteLock.Lock Method

Definition

Acquires the write lock.

[Android.Runtime.Register("lock", "()V", "GetLockHandler")]
public virtual void Lock ();
[<Android.Runtime.Register("lock", "()V", "GetLockHandler")>]
abstract member Lock : unit -> unit
override this.Lock : unit -> unit

Implements

Attributes

Remarks

Acquires the write lock.

Acquires the write lock if neither the read nor write lock are held by another thread and returns immediately, setting the write lock hold count to one.

If the current thread already holds the write lock then the hold count is incremented by one and the method returns immediately.

If the lock is held by another thread then the current thread becomes disabled for thread scheduling purposes and lies dormant until the write lock has been acquired, at which time the write lock hold count is set to one.

Java documentation for java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock.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