Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Multithreading doubt

 
nmohan kumar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have coded 3 thread classes.The first two thread classes do file processing and the last one interacts with Beyond compare.let s say t1,t2 and t3.so,in the servlet i have coded like,

t1.start();
t2.start();
t2.join();

i tried this..and it worked out..can someone explain me wat is exactly happeing ,when the above code is being run?

and then t i want the t3 to be run after t1 and t2 finish running..how can i make it?..
 
Jim Hoglund
Ranch Hand
Posts: 525
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From your current thread, you created t1 and t2 and
told the JVM to start them both. Then, with t2.join()
you paused the current thread. It will start again
when t2's run() method has completed.

From your current thread, you can also do a t1.join().
So when your thread runs again, both t1 and t2 will
have completed and you can issue a t3.start().

Jim ... ... Oh yes - and welcome to the Ranch . . .
 
nmohan kumar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Jim.It worked fine.



 
No one can make you feel inferior without your consent - Eleanor Roosevelt. tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!