Hi all,
I'm probably missing something here, as I haven't worked much with Threads & ThreadGroups, but it seems to me that a join() method would be useful in ThreadGroup, & here's why:
I want to spawn a thread for each entry in a queue, and I need my calling thread not to die until each of the spawned threads has finished. The only way I can come up with to do this is to add each Thread to a Vector (Java 1.1.8 - no ArrayList ), and then loop through the elements of the Vector and call join() on each in turn.
Why can't I add my created Threads to a ThreadGroup, and then call a join() on the ThreadGroup as a whole? I'm hoping that the answers will give me more insight into what the ThreadGroup class is really for.
Thanks
Dave
I'm probably missing something here, as I haven't worked much with Threads & ThreadGroups, but it seems to me that a join() method would be useful in ThreadGroup, & here's why:
I want to spawn a thread for each entry in a queue, and I need my calling thread not to die until each of the spawned threads has finished. The only way I can come up with to do this is to add each Thread to a Vector (Java 1.1.8 - no ArrayList ), and then loop through the elements of the Vector and call join() on each in turn.
Why can't I add my created Threads to a ThreadGroup, and then call a join() on the ThreadGroup as a whole? I'm hoping that the answers will give me more insight into what the ThreadGroup class is really for.
Thanks
Dave