This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

thread  RSS feed

 
abalfazl hossein
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

May you explain about this?
You can ask another object to perform an operation that manipulates its own lock. To do this, you must first capture that object´┐Żs lock. For example, if you want to notify( ) an object x, you must do so inside a synchronized block that acquires the lock for x:


 
ahmed yehia
Ranch Hand
Posts: 424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

if you want to notify( ) an object x, you must do so inside a synchronized block that acquires the lock for x:

This is because in order to call wait() notify() notifyAll() on an object, the thread first must acquire the lock for that object.
This can be done by synchronizing the code that is making these method calls.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!