示例#1
0
 private static void AccessEcSynchronized(Action <IEmbeddedController> callback, IEmbeddedController ec)
 {
     if (ec.AcquireLock(200))
     {
         try
         {
             callback(ec);
         }
         finally
         {
             ec.ReleaseLock();
         }
     }
 }
示例#2
0
 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");
     }
 }
示例#3
0
        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");
            }
        }
示例#4
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.ProcessExit += (s, e) =>
            {
                if (ec != null)
                {
                    try
                    {
                        ec.ReleaseLock();
                        ec.Dispose();
                    }
                    catch { }
                }
            };

            try
            {
                ParseArgs(args);
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.Message);
            }
        }