Thread.Stop Method

Definition

Overloads

Stop()
Obsolete.

Throws UnsupportedOperationException.

Stop(Throwable)
Obsolete.

Throws UnsupportedOperationException.

Stop()

Caution

deprecated

Throws UnsupportedOperationException.

[Android.Runtime.Register("stop", "()V", "")]
[System.Obsolete("deprecated")]
public void Stop ();
[<Android.Runtime.Register("stop", "()V", "")>]
[<System.Obsolete("deprecated")>]
member this.Stop : unit -> unit
Attributes

Remarks

Throws UnsupportedOperationException.

This member is deprecated. This method was originally designed to force a thread to stop and throw a ThreadDeath as an exception. It was inherently unsafe. Stopping a thread with Thread.stop causes it to unlock all of the monitors that it has locked (as a natural consequence of the unchecked ThreadDeath exception propagating up the stack). If any of the objects previously protected by these monitors were in an inconsistent state, the damaged objects become visible to other threads, potentially resulting in arbitrary behavior. Many uses of stop should be replaced by code that simply modifies some variable to indicate that the target thread should stop running. The target thread should check this variable regularly, and return from its run method in an orderly fashion if the variable indicates that it is to stop running. If the target thread waits for long periods (on a condition variable, for example), the interrupt method should be used to interrupt the wait. For more information, see Why are Thread.stop, Thread.suspend and Thread.resume Deprecated?.

Java documentation for java.lang.Thread.stop().

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

Stop(Throwable)

Caution

deprecated

Throws UnsupportedOperationException.

[Android.Runtime.Register("stop", "(Ljava/lang/Throwable;)V", "")]
[System.Obsolete("deprecated")]
public void Stop (Java.Lang.Throwable? obj);
[<Android.Runtime.Register("stop", "(Ljava/lang/Throwable;)V", "")>]
[<System.Obsolete("deprecated")>]
member this.Stop : Java.Lang.Throwable -> unit

Parameters

obj
Throwable

ignored

Attributes

Remarks

Throws UnsupportedOperationException.

This member is deprecated. This method was originally designed to force a thread to stop and throw a given Throwable as an exception. It was inherently unsafe (see #stop() for details), and furthermore could be used to generate exceptions that the target thread was not prepared to handle. For more information, see Why are Thread.stop, Thread.suspend and Thread.resume Deprecated?.

Java documentation for java.lang.Thread.stop(java.lang.Throwable).

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