> Thread[] ts; int count;
> do {
> CurrentThread.yield();
> count = 0;
> ts = new Thread[Thread.activeCount()];
> int n = Thread.enumerate(ts);
> for (int i = 0; i < n ; i++) {
> if (!ts[i].isDaemon())
> count++;
> }
> } while (count > 1);
> System.getRuntime().exit(exitStatus);
>
> which is a little kludgy).
Instead of this, perhaps you could add a static counter to Thread that is
increased every time a new Thread is created, and decrease every time a
thread is done, and if the total is zero after this operation return a
System.exit(value). Also the exit value could neatly be put as a static in
this Thread class... I'm ofcourse here refering to some class that extends
Thread. :-)
--typo
_______________________________________________
Freenet-dev mailing list
Freenet-dev at lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/freenet-dev