protected static I Provider
{
if (_provider == null)
{
lock (_syncLock)
{
if (provder = null)
provider =
Activator.createfromconfig(...);
}
}
return _provider;
}
But, that is a double-check lock, and I would need to document that at least
the BaseManager.Provider property is thread safe.
Yes, but your DCL is broken. However, if you rewrite it like this:
if (provider_ == null)
{
lock (syncLock_)
{
if (provider_ == null)
{
I instance = Activator....
Thread.MemoryBarrier(); // so that any out-of-order writes
complete[1]
provider_ = instance;
}
}
}
it will become thread-safe.
Cheers,
Stoyan
[1] I think I've read this a couple of years ago in Brad Abrams blog.
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com