Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
Most 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. (This is the approach that JavaSoft's Tutorial has always recommended.) To ensure prompt communication of the stop-request, the variable must be volatile (or access to the variable must be synchronized). For example, suppose your applet contains the following start, stop and run methods: private Thread blinker; public void start() { public void stop() { public void run() { You can avoid the use of Thread.stop by replacing the applet's stop and run methods with: public void stop() { public void run() { For full info on this topic goto I hope this link helps you to understand your problem. Senthoor
Replies: |
Sponsored Links
|