• 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
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

wait x join

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

What is the diference between the use of wait x join?
What can I do with one method and I can not obtain with the other?
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i) wait: With wait you can terminate the execution of current thread until you get a notify from
other thread. Once you make a thread wait any other thread can run after that. By calling
this you have just temporarily released the lock on the object.

ii)join: when you call join on a thread, you are telling the current thread that you will get a
chance of execution immediately after this thread is completed. eg

public static void main(String...args)
{
MyThread t=new MyThread();
t.start();
t.join();
//here you are telling main method Thread that you can start you execution immediately after
//MyThread is executed
}
 
They worship nothing. They say it's because nothing lasts forever. Like this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic