Thread.HoldsLock(Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns true
if and only if the current thread holds the
monitor lock on the specified object.
[Android.Runtime.Register("holdsLock", "(Ljava/lang/Object;)Z", "")]
public static bool HoldsLock (Java.Lang.Object obj);
[<Android.Runtime.Register("holdsLock", "(Ljava/lang/Object;)Z", "")>]
static member HoldsLock : Java.Lang.Object -> bool
Parameters
- obj
- Object
the object on which to test lock ownership
Returns
true
if the current thread holds the monitor lock on
the specified object.
- Attributes
Remarks
Returns true
if and only if the current thread holds the monitor lock on the specified object.
This method is designed to allow a program to assert that the current thread already holds a specified lock:
assert Thread.holdsLock(obj);
Added in 1.4.
Java documentation for java.lang.Thread.holdsLock(java.lang.Object)
.
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.