aspose file tools*
The moose likes Java in General and the fly likes Threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Threads" Watch "Threads" New topic
Author

Threads

Vrishal Likhite
Greenhorn

Joined: Nov 21, 2005
Posts: 18
hello everyone
i am having two Thead objects declared as bellow
final Thread t1=new Thread(new Runnable()
{
public void run(){}
});
final Thread t2=new Thread(new Runnable()
{
public void run(){
t1.start();
}
});
t1.start();
t2.start();


wat i m facing is the thread t1 is not getting started from within t2
if i want to do so wats the way out? y is this code not working

Thanx
Stuart Ash
Ranch Hand

Joined: Oct 07, 2005
Posts: 637
How do you say it is not started.

Also, you are trying to start the same thread twice, obviously that won't work?


ASCII silly question, Get a silly ANSI.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

As Stuart pointed out, you are trying to call start twice on the same thread, and you can't do that.

But you can pass the same instance of Runnable to a new thread...


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Vrishal Likhite
Greenhorn

Joined: Nov 21, 2005
Posts: 18
Hey marc thanx for ur reply
the code u sent might just prove helpfull to me in my work
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Threads