Share via


LockSupport.SetCurrentBlocker(Object) Method

Definition

Sets the object to be returned by invocations of #getBlocker getBlocker for the current thread.

[Android.Runtime.Register("setCurrentBlocker", "(Ljava/lang/Object;)V", "", ApiSince=34)]
public static void SetCurrentBlocker (Java.Lang.Object? blocker);
[<Android.Runtime.Register("setCurrentBlocker", "(Ljava/lang/Object;)V", "", ApiSince=34)>]
static member SetCurrentBlocker : Java.Lang.Object -> unit

Parameters

blocker
Object

the blocker object

Attributes

Remarks

Sets the object to be returned by invocations of #getBlocker getBlocker for the current thread. This method may be used before invoking the no-argument version of LockSupport#park() park() from non-public objects, allowing more helpful diagnostics, or retaining compatibility with previous implementations of blocking methods. Previous values of the blocker are not automatically restored after blocking. To obtain the effects of park(b}, use setCurrentBlocker(b); park(); setCurrentBlocker(null);

Added in 14.

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

Applies to