Esempio n. 1
0
 private static void AccessEcSynchronized(Action <IEmbeddedController> callback, IEmbeddedController ec)
 {
     if (ec.AcquireLock(200))
     {
         try
         {
             callback(ec);
         }
         finally
         {
             ec.ReleaseLock();
         }
     }
 }
Esempio n. 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");
     }
 }
Esempio n. 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");
            }
        }
Esempio n. 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);
            }
        }