編輯

共用方式為


SpinLock.IsHeldByCurrentThread Property

Definition

Gets whether the lock is held by the current thread.

public:
 property bool IsHeldByCurrentThread { bool get(); };
public bool IsHeldByCurrentThread { get; }
member this.IsHeldByCurrentThread : bool
Public ReadOnly Property IsHeldByCurrentThread As Boolean

Property Value

true if the lock is held by the current thread; otherwise false.

Exceptions

Thread ownership tracking is disabled.

Remarks

If the lock was initialized to track owner threads, this will return whether the lock is acquired by the current thread. It is invalid to use this property when the lock was initialized to not track thread ownership.

Applies to

See also