Struct with default ctor (Was: [dmd-beta] dmd 2.064 beta take 2)

Walter Bright newshound2 at digitalmars.com
Sun May 19 14:02:56 PDT 2013


On 5/19/2013 11:22 AM, deadalnix wrote:
> The damn thing should have been initialized in the
> first place to avoid the bug.

Sounds like you have the double-checked locking bug. Using a different value to 
initialize it won't fix it.

If you have a global value accessible from multiple threads, you must use 
synchronization. There is no way around that. If you use some other global state 
to check for initialization in order to avoid synchronization, you have the 
double checked locking bug. Yes, you do.



More information about the Digitalmars-d mailing list