• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Threads

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey marc thanx for ur reply
the code u sent might just prove helpfull to me in my work
 
reply
    Bookmark Topic Watch Topic
  • New Topic