private static void AccessEcSynchronized(Action <IEmbeddedController> callback, IEmbeddedController ec) { if (ec.AcquireLock(200)) { try { callback(ec); } finally { ec.ReleaseLock(); } } }
private static void AccessEcSynchronized(Action <IEmbeddedController> callback, IEmbeddedController ec) { if (ec.AcquireLock(200)) { try { callback(ec); } finally { ec.ReleaseLock(); } } else { Console.Error.WriteLine("Could not acquire EC lock"); } }
private static void AccessEcSynchronized(Action <IEmbeddedController> callback) { var ecLoader = new FanControlPluginLoader <IEmbeddedController>(FanControl.PluginsDirectory); IEmbeddedController ec = ecLoader.FanControlPlugin; ec.Initialize(); if (ec.AcquireLock(200)) { try { callback(ec); } finally { ec.ReleaseLock(); } } else { Console.Error.WriteLine("Error connecting to Embedded Controller"); } }