Quantcast
Channel: The Old New Thing
Viewing all articles
Browse latest Browse all 24428

re: The debugger lied to you because it the CPU was still juggling data in the air

$
0
0

@Mike Dimmick: You can implement mutexes without bidirectional memory fences? No idea about ARM, but on x86 that *should* make a difference, especially since you also need some further bookkeeping for mutexes (ok you get around the kernel object for CriticalSections afaik, so probably not too bad). But yes double-checked locking is one of those cute tricks that doesn't make any noticeable difference in 99% of the time and is still easy to get wrong (and even if programmers get it right, they probably have no idea why it works), I'm not really advocating them for general use.

Anyway, yes I know what a memory model is, but I haven't really studied the new c++11 one in any detail. Java5+ as well as the C# memory model for volatiles does guarantee that the simple double-checked locking implementation works btw.


Viewing all articles
Browse latest Browse all 24428

Trending Articles