jmdavis/phobos — comment on commit d3816f156e9beaef23879a31f819e6df4474353d
File: std/datetime.d line 28703
By andralex:

Almost there. Don't forget that atomicLoad refers to shared memory locations (which temp is not but _utc is), so you need to apply atomicLoad to _utc directly like this:

```d
auto temp = atomicLoad!(msync.acq)(_utc);
if (!temp)
{
synchronized
{
if (!_utc) // no need for a second atomic load
{
_utc = cast(UTC)(temp = ...); // no need for an atomic store
}
}
return temp;
}

If I'm not wrong, this does an atomic load and an atomic store which is implied by the use of synchronize. Thats all we need. Same goes for the other similar pattern. Thanks!