Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The thread that is updating the 3D view should periodically check some flag (use a <code>volatile boolean</code>) to see if it should terminate. When you want to abort the thread, just set the flag. When the thread next checks the flag, it should simply break out of whatever loop it is using to update the view and return from its <code>run</code> method.</p> <p>If you truly cannot access the code the Thread is running to have it check a flag, then there is no safe way to stop the Thread. Does this Thread ever terminate normally before your application completes? If so, what causes it to stop?</p> <p>If it runs for some long period of time, and you simply must end it, you can consider using the deprecated <code>Thread.stop()</code> method. However, it was deprecated for a good reason. If that Thread is stopped while in the middle of some operation that leaves something in an inconsistent state or some resource not cleaned up properly, then you could be in trouble. Here's a note from the <a href="http://java.sun.com/javase/6/docs/api/java/lang/Thread.html#stop()" rel="nofollow noreferrer">documentation</a>:</p> <blockquote> <p>This method is 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 <a href="http://java.sun.com/javase/6/docs/technotes/guides/concurrency/threadPrimitiveDeprecation.html" rel="nofollow noreferrer">Why are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a></p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload