Exemplo n.º 1
0
 internal static Thread RunAsyncTask(AsyncFunction functionBlock)
 {
     var asyncTask = new Thread(() =>
     {
         try
         {
             functionBlock();
         }
         catch (Exception ex)
         {
             HomeGenieService.LogError(Domains.HomeAutomation_HomeGenie, "Service.Utility.RunAsyncTask", ex.Message, "Exception.StackTrace", ex.StackTrace);
         }
     });
     asyncTask.Start();
     return asyncTask;
 }
Exemplo n.º 2
0
        public static Thread RunAsyncTask(AsyncFunction fnblock)
        {
            Thread at = new Thread(new ThreadStart(() =>
            {
                try
                {
                    fnblock();
                }
                catch (Exception ex)
                {
                    HomeGenieService.LogEvent(Domains.HomeAutomation_HomeGenie, "Service.Utility.RunAsyncTask", ex.Message, "Exception.StackTrace", ex.StackTrace);
                }
            }));

            at.Start();
            return(at);
        }
Exemplo n.º 3
0
        public static AsyncThread Borrow(AsyncFunction function)
        {
            AsyncThread thread = null;

            lock (mainLock)
            {
                if (queue.Count > 0)
                {
                    thread = queue[0];
                    queue.RemoveAt(0);
                }
            }
            if (thread == null)
            {
                thread = new AsyncThread();
            }
            thread.function = function;
            thread.wait.Set();
            return(thread);
        }
Exemplo n.º 4
0
 protected ActionResult None(
     AsyncFunction afterCompletion = null,
     bool awaitCallback            = true)
 => new NoResult(afterCompletion, awaitCallback);
Exemplo n.º 5
0
 protected ActionResult Ok(
     AsyncFunction logic,
     bool awaitLogic = true)
 => new OkResult(logic, awaitLogic);
Exemplo n.º 6
0
 public NoResult(AsyncFunction afterCompletion = null, bool awaitCallback = true)
 {
     _after         = afterCompletion;
     _awaitCallback = awaitCallback;
 }