I got it,
but, why my run() always run once?
why not a loop??
strange....
Best regards,
Boki.
"Tor Iver Wilhelmsen" <tor.iver.wilhelmsen@broadpark.no>
???????:u4qfi37xd.fsf@broadpark.no...
>> What is run() mean? It seems run with no caller, the same trigge like
>> startApp(), pause(), destroy()?
[quoted text clipped - 3 lines]
> is one of therese, esp. in Runnable, where a Thread object is supposed
> to do the call to run().
Thomas Schodt - 21 Mar 2005 17:37 GMT
> I got it,
> but, why my run() always run once?
>
> why not a loop??
If you need a loop, you should put it in the run() method.
class Worker implements Runnable {
private boolean active = true;
private Thread me;
public void run() {
me = Thread.currentThread();
while(active) {
// do your never-ending processing here
}
}
public terminate() {
active = false;
me.interrupt(); // works for sleep()
}
}
class Fubar {
Worker w = new Worker();
new Thread(w).start();
...
w.terminate();
}
boki - 22 Mar 2005 01:55 GMT
Hi Thomas,
Thanks a lot.
Best regards,
Boki.
> > I got it,
> > but, why my run() always run once?
[quoted text clipped - 24 lines]
> w.terminate();
> }