Home arrow static arrow Java Programming [Archive] - Adding Custom Threads to a ThreadGroup
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Adding Custom Threads to a ThreadGroup
This topic has 1 reply on 1 page.

Posts:3
Registered: 10/29/03
Adding Custom Threads to a ThreadGroup  
Jul 27, 2004 6:09 PM



 
Hi all.

I am haveing trouble figuring out how to add MyThread to a ThreadGroup. I have a Runnable thread MyThread that extends Thread, which I want to add to ThreadGroup threadgroup. From what I can find, You can only add a Thread to a ThreadGroup when you call the Thread constructor. Any ideas? Is what I'm trying to do clear?
 

Posts:37,103
Registered: 3/30/99
Re: Adding Custom Threads to a ThreadGroup  
Jul 27, 2004 6:37 PM (reply 1 of 1)



 
Hi all.

I am haveing trouble figuring out how to add MyThread
to a ThreadGroup. I have a Runnable thread MyThread
that extends Thread, which I want to add to
ThreadGroup threadgroup. From what I can find, You
can only add a Thread to a ThreadGroup when you call
the Thread constructor. Any ideas? Is what I'm
trying to do clear?

Well, obviously you're constructing one of the Threads. So as the first line of your class' constructor, call super(...) to invoke one of Thread's constructors that takes a ThreadGroup.
 
This topic has 1 reply on 1 page.