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!
    Bookmark Topic Watch Topic
  • New Topic

question: non-synchronized methods  RSS feed

 
Douglas Chorpita
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Report post to moderator
A question for the real profis.

When a thread enters a synchronized method (or block) and locks the object, what happens when a non-synchronized method is called within this synchronized block? Does the thread give ups its lock? Or does it wait until leaving the synchronized method (or block)?

In other words, are non-synchronized methods only non-synchronized when called directly, but are "synchronization-supporting" (in the sense that they keep the established lock) as long as they are called from a synchronized context? What is going on exactly?

This may be a tough question. Be honest, if you are not sure about the answer.

Thanks.

Is my question clear?
 
Henry Wong
author
Sheriff
Posts: 22841
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Douglas,

Please do not crosspost, it wastes people's time and effort... Anyway, I am going to lock this thread, as the other one has more answers. And I am going to move the other thread here, as this forum looks more appropriate.

Give me a sec... We'll get to your question shortly.

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