I have set up a thread and I want to run it using a loop. Therefore, this thread should run in the loop and break in a fixed time and then the loop should run.
Please do not have any clue how to do this. Can someone guide me?
Believing that you are running on JDK 1.5 or new ( Where the memory model was clarified and improved) You can use
Public category MyRunnable Runnabel {Personal volatile Boolean cancellation; Public Null Run () (While Canceled) {doStuff ();}} Public Cancellation () {Cancel = true;} Public Boolean has been canceled () {Cancellation canceled}} J
Alternatively, use, and futuresk, which supports cancellation outside the box.
Comments
Post a Comment