Doubt about Synchronized Code Clocks

d coder dlang.coder at gmail.com
Tue Mar 1 06:40:31 PST 2011


Greetings

I have a doubt about synchronized code blocks.

I learnt that in Java the synchronized keyword has two fold effect.
Firstly it locks the code to make sure that only a single thread gets
access to the code block at a given time. Secondly, it makes sure that
the data elements accessed inside the code block are not "stale". As a
result Java programming practice is to synchronize even access
functions that access shared data elements.

How about D? Does D synchronized keyword just result in mutex locking
of the code block? Or does it also ensure that the accessed shared
data elements are not stale?

Thanks and Regards
- Puneet


More information about the Digitalmars-d-learn mailing list