Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

question: non-synchronized methods

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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