File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Threads

 
Vrishal Likhite
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 637
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you say it is not started.

Also, you are trying to start the same thread twice, obviously that won't work?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Vrishal Likhite
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic