• Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference between wait and join  RSS feed

 
Sunil Palicha
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between wait and join ?

One difference that I am aware of is wait needs to be used in
synchronized method or block whereas join can come right after
start().

Can join be used to act as wait ? If yes, under what conditions ?
 
Henry Wong
author
Sheriff
Posts: 23280
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sunil Palicha:
What is the difference between wait and join ?

One difference that I am aware of is wait needs to be used in
synchronized method or block whereas join can come right after
start().

Can join be used to act as wait ? If yes, under what conditions ?


The join() method is used to wait for a thread to complete execution, and the wait() method is used to wait for a notification to be sent on an object. The two conditions are pretty distinctive.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!