• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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
}
 
I yam what I yam and that's all that I yam - the great philosopher Popeye. Tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic