{
}
+ // Locked by caller
public static bool GetInstance (out IFileWatcher watcher)
{
- lock (typeof (DefaultWatcher)) {
- if (instance != null) {
- watcher = instance;
- return true;
- }
-
- instance = new DefaultWatcher ();
+ if (instance != null) {
watcher = instance;
return true;
}
+
+ instance = new DefaultWatcher ();
+ watcher = instance;
+ return true;
}
public void StartDispatching (FileSystemWatcher fsw)
public void StopDispatching (FileSystemWatcher fsw)
{
DefaultWatcherData data;
+ lock (this) {
+ if (watches == null) return;
+ }
+
lock (watches) {
data = (DefaultWatcherData) watches [fsw];
if (data != null) {
my_watches = (Hashtable) watches.Clone ();
}
- if (watches.Count != 0) {
+ if (my_watches.Count != 0) {
zeroes = 0;
foreach (DefaultWatcherData data in my_watches.Values) {
bool remove = UpdateDataAndDispatch (data, true);