X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem%2FSystem.IO%2FKeventWatcher.cs;h=d26c30e22f7935e391891119397ce1a9449770fb;hb=dd19011aa66c00977c4e18b959d8c317860cbb63;hp=803629effcdc3f7e2f31c405466e92e896687d7c;hpb=4013a9bd291df161f40c90979e70feef996b3c38;p=mono.git diff --git a/mcs/class/System/System.IO/KeventWatcher.cs b/mcs/class/System/System.IO/KeventWatcher.cs index 803629effcd..d26c30e22f7 100644 --- a/mcs/class/System/System.IO/KeventWatcher.cs +++ b/mcs/class/System/System.IO/KeventWatcher.cs @@ -93,32 +93,31 @@ namespace System.IO { { } + // Locked by caller public static bool GetInstance (out IFileWatcher watcher) { - lock (typeof (KeventWatcher)) { - if (failed == true) { - watcher = null; - return false; - } - - if (instance != null) { - watcher = instance; - return true; - } - - watches = Hashtable.Synchronized (new Hashtable ()); - requests = Hashtable.Synchronized (new Hashtable ()); - conn = kqueue(); - if (conn == -1) { - failed = true; - watcher = null; - return false; - } + if (failed == true) { + watcher = null; + return false; + } - instance = new KeventWatcher (); + if (instance != null) { watcher = instance; return true; } + + watches = Hashtable.Synchronized (new Hashtable ()); + requests = Hashtable.Synchronized (new Hashtable ()); + conn = kqueue(); + if (conn == -1) { + failed = true; + watcher = null; + return false; + } + + instance = new KeventWatcher (); + watcher = instance; + return true; } public void StartDispatching (FileSystemWatcher fsw)