HandlerThread.QuitSafely Method

Definition

Quits the handler thread's looper safely.

[Android.Runtime.Register("quitSafely", "()Z", "GetQuitSafelyHandler")]
public virtual bool QuitSafely ();
[<Android.Runtime.Register("quitSafely", "()Z", "GetQuitSafelyHandler")>]
abstract member QuitSafely : unit -> bool
override this.QuitSafely : unit -> bool

Returns

True if the looper looper has been asked to quit or false if the thread had not yet started running.

Attributes

Remarks

Quits the handler thread's looper safely.

Causes the handler thread's looper to terminate as soon as all remaining messages in the message queue that are already due to be delivered have been handled. Pending delayed messages with due times in the future will not be delivered.

Any attempt to post messages to the queue after the looper is asked to quit will fail. For example, the Handler#sendMessage(Message) method will return false.

If the thread has not been started or has finished (that is if #getLooper returns null), then false is returned. Otherwise the looper is asked to quit and true is returned.

Java documentation for android.os.HandlerThread.quitSafely().

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