Basic HTML version of Foils prepared March 26 1999

Foil 19 Starting and Stopping the Thread

From Java Academy:Graphical User Interface NPAC Java Academy February--April 99 -- March 1999. by Nancy McCracken


1 When the thread is created, it doesn't start running yet. You must call a method called thread.start, and you can stop it from running by calling thread.stop.
2 When the thread starts, it starts executing the run method. If it stops and then starts again, it continues the run method.
3 It is good design to put these calls to thread.start and thread.stop in the start and stop methods of the applet, so that the thread doesn't run whenever the applet window is not running.
4 Threads have other methods, such as thread.suspend and thread.resume when the user wants to start and stop the thread.

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Fri Mar 26 1999