Jeroen Frijters wrote:
Now I realize that Sun's JDK has the same bug:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4410846
Can we fix this simply by having the references from the
ThreadGroup -> Thread be via weak references?
Because it would mean that the semantics change. There could be code
that does:
new Thread("MyThread");
...
...
ThreadGroup g = Thread.currentThread().getThreadGroup();
Thread[] threads = new Thread[g.activeCount()];
g.enumerate(threads);
for(int i = 0; i < threads.length; i++)
{
if(threads[i].getName("MyThread"))
threads[i].start();
}
Good point.. this is one of those bugs in the API that
requires the implementation to have a memory leak.
However, I couldn't find any definition of an "active" thread.
Empirically it seems to mean "either not yet started or
still running".
Seems like the "not yet started" part is questionable though.
By the way this is a real problem e.g. in an application where
you create a thread and then decide to start it later (or not)
based on some last minute information.
-Archie
__________________________________________________________________________
Archie Cobbs * CTO, Awarix * http://www.awarix.com
_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/classpath