Possible duplicate:
Double check blocking in .net
EDIT: many changes to clarify this question not about singleton
I find myself writing code as follows:
if(resourceOnDiskNeedsUpdating) { lock(lockObject) { if(resourceOnDiskNeedsUpdating)
UpdateResource() is a slow operation. Does this template make sense?
Are there any better alternatives?
c # locking double-checked-locking
Myster Feb 18 2018-11-18T00: 00Z
source share