• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Notify all

 
Sudhanshu Mishra
Ranch Hand
Posts: 236
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have a question regarding notifyall(),wait() and notify().
What if i notify a thread which is not waiting on an objects lock,i.e what if the code with notify() runs before the code with wait()?
 
Piyush Joshi
Ranch Hand
Posts: 207
Eclipse IDE Firefox Browser jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sudhanshu Mishra wrote: what if the code with notify() runs before the code with wait()?

then nothing will happen.
For example:


thread2 will keep on waiting on lock1.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic