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; }
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); }
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); }
protected ActionResult None( AsyncFunction afterCompletion = null, bool awaitCallback = true) => new NoResult(afterCompletion, awaitCallback);
protected ActionResult Ok( AsyncFunction logic, bool awaitLogic = true) => new OkResult(logic, awaitLogic);
public NoResult(AsyncFunction afterCompletion = null, bool awaitCallback = true) { _after = afterCompletion; _awaitCallback = awaitCallback; }