26
juin
2009
Citation du jour : It doesn’t work
juin
2009
Un article de djo.mos
Pas de commentaires
It doesn’t work
There are lots of reasons it doesn’t work. The first couple of reasons we’ll describe are more obvious. After understanding those, you may be tempted to try to devise a way to « fix » the double-checked locking idiom. Your fixes will not work: there are more subtle reasons why your fix won’t work. Understand those reasons, come up with a better fix, and it still won’t work, because there are even more subtle reasons.
Lots of very smart people have spent lots of time looking at this. There is no way to make it work without requiring each thread that accesses the helper object to perform synchronization.
J’adore