Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The wai() method

 
ravinderSingh singh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When a thread invokes the wait() method on an object whose lock it holds, does the thread only release the lock on the object it invoked the wait method on, or does it release all the object locks it holds (assuming it holds other object locks)?

Thanks
 
Henry Wong
author
Marshal
Pie
Posts: 21117
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both...

The wait() method will only release the lock of the object that you are waiting on. However, it is possible to grab the same lock more than once, and the wait method will release *all* the grabs of the waiting lock.

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic