Non-atomic ops allowed on shared variables?

David Nadlinger see at klickverbot.at
Sat Dec 3 11:22:40 PST 2011


On 12/3/11 8:19 PM, Jonathan M Davis wrote:
> Sure, if you use anything other
> than an atomic operation on a shared object and don't use a synchronized block
> or a mutex or the like, you risk race conditions, but if every operation on a
> shared object had to actually be atomic, you couldn't do much of anything to
> them.

Isn't that exactly the point? What are the guarantees of shared 
otherwise? I agree that the current behavior is counter-intuitive and 
bug-prone.

David


More information about the Digitalmars-d-learn mailing list