Created
February 27, 2012 05:52
-
-
Save takekazuomi/1921769 to your computer and use it in GitHub Desktop.
Double-checked locking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static FileSystemWatcherPool sInstance; | |
private static object sLock = new object(); | |
private FileSystemWatcherPool() { | |
this.cleanupTimer = new Timer(InvalidateWatcherList, null, OneMinute, OneMinute); | |
} | |
public static FileSystemWatcherPool Instance { | |
get { | |
if (sInstance == null) { | |
lock (sLock) { | |
if (sInstance == null) { | |
sInstance = new FileSystemWatcherPool(); | |
} | |
} | |
} | |
return sInstance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment