
Signature
Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew
> A Thread will not make an 'infinite loop' more efficient.
> Or rather, if the 'infinite loop' is a bug, a Thread will
> not improve things.
I know, that's why I want to change it. The cause of the infinite loop
is the fact that the while statement cannot complete without throwing
an exception.
run() {
while (true) {
}
}
Andrew Thompson - 10 Dec 2005 16:30 GMT
>>A Thread will not make an 'infinite loop' more efficient.
>>Or rather, if the 'infinite loop' is a bug, a Thread will
[quoted text clipped - 6 lines]
> run() {
> while (true) {
What happens here?
Is the basic problem that your program/GUI has become
unresponsive at a time that the program is doing
something that takes a long time?
> }
> }
(If the answer to the above is 'yes', you might find tips
by searching the groups for 'block EDT'. Otherwise, I
might need more information about what is happening inside
that loop, and why you need to throw an exception to stop it.)

Signature
Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew
VisionSet - 10 Dec 2005 18:55 GMT
> > A Thread will not make an 'infinite loop' more efficient.
> > Or rather, if the 'infinite loop' is a bug, a Thread will
[quoted text clipped - 9 lines]
> }
> }
> ...seems to be in an infinite loop...
?? Surely you know it is an infinite loop
Well don't use an infinite loop then.
If you know the condition that you want to stop the thread, then specify it
in the while statement.
or a really generic approach:
Runnable myRunnable = new Runnable() {
boolean keepRunning = true;
void stopThread() {
keepRunning = false;
}
public void run() {
while(keepRunning) {
//stuff
}
}
}
--
Mike W