If provider_ is only set in that one place, or if it's set elsewhere and
within(syncLock_) you don't need the MemoryBarrier.  Enter guarantees
acquire semantics and does the memory barrier for you (at the start of the
lock, and since nothing else can access provider while in the lock,
there's no need for the MemoryBarrier).

But isn't the point (and also the issue the barrier tries to solve)
that code from outside the lock actually does access _provider in the
double-checked locking pattern? So "nothing else can access provider
while in the lock" seems not to be true, or is it?

Fabian

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to