Dela via


Object.Notify Method

Definition

Wakes up a single thread that is waiting on this object's monitor.

[Android.Runtime.Register("notify", "()V", "")]
public void Notify ();
[<Android.Runtime.Register("notify", "()V", "")>]
member this.Notify : unit -> unit
Attributes

Remarks

Wakes up a single thread that is waiting on this object's monitor. If any threads are waiting on this object, one of them is chosen to be awakened. The choice is arbitrary and occurs at the discretion of the implementation. A thread waits on an object's monitor by calling one of the wait methods.

The awakened thread will not be able to proceed until the current thread relinquishes the lock on this object. The awakened thread will compete in the usual manner with any other threads that might be actively competing to synchronize on this object; for example, the awakened thread enjoys no reliable privilege or disadvantage in being the next thread to lock this object.

This method should only be called by a thread that is the owner of this object's monitor. A thread becomes the owner of the object's monitor in one of three ways: <ul> <li>By executing a synchronized instance method of that object. <li>By executing the body of a synchronized statement that synchronizes on the object. <li>For objects of type Class, by executing a synchronized static method of that class. </ul>

Only one thread at a time can own an object's monitor.

Java documentation for java.lang.Object.notify().

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

See also