private void TryWork(PumpMessage work) { try { work.Execute(); } catch (Exception ex) { PumpExceptionArgs exceptionArgs = new PumpExceptionArgs(ex); PumpException.Fire(exceptionArgs); if (exceptionArgs.Handled == false) { if (ex.InnerException != null) { ExceptionDispatchInfo.Capture(ex.InnerException).Throw(); } else { ExceptionDispatchInfo.Capture(ex).Throw(); } } } #if PROFILING CliProfiler.Instance.TotalMessagesProcessed++; #endif }
private void TryWork(PumpMessage work) { try { work.Execute(); if (work.Deferred != null) { work.Deferred.Resolve(); } } catch (Exception ex) { work.Deferred?.Reject(ex); PumpExceptionArgs exceptionArgs = new PumpExceptionArgs(ex); PumpException.Fire(exceptionArgs); if (exceptionArgs.Handled == false) { if (ex.InnerException != null) { ExceptionDispatchInfo.Capture(ex.InnerException).Throw(); } else { ExceptionDispatchInfo.Capture(ex).Throw(); } } } }
protected void QueueActionInFront(PumpMessage pumpMessage) { lock (pumpMessageQueue) { pumpMessageQueue.Insert(0, pumpMessage); } }
/// <summary> /// Queues the given message for processing on the pump thread /// </summary> /// <param name="pumpMessage">the message that will be processed in order on the pump thread</param> protected void QueueAction(PumpMessage pumpMessage) { lock (pumpMessageQueue) { pumpMessageQueue.Add(pumpMessage); } }
/// <summary> /// Puts the given action into the work queue, but skips it to the front of the queue /// </summary> /// <param name="a">the action code to run</param> /// <returns>a promise that will resolve when the work is done</returns> protected Promise QueueActionInFront(Action a) { var d = Deferred.Create(); var pumpMessage = new PumpMessage(a) { Deferred = d }; QueueActionInFront(pumpMessage); return(d.Promise); }
/// <summary> /// Queues the given action for processing on the pump thread /// </summary> /// <param name="a">the action that will be processed in order on the pump thread</param> public Promise QueueAction(Action a) { var d = Deferred.Create(); var pumpMessage = new PumpMessage(a) { Deferred = d }; QueueAction(pumpMessage); return(d.Promise); }
/// <summary> /// Queues the given message for processing on the pump thread /// </summary> /// <param name="pumpMessage">the message that will be processed in order on the pump thread</param> public void QueueAction(PumpMessage pumpMessage) { lock (pumpMessageQueue) { pumpMessageQueue.Add(pumpMessage); #if PROFILING CliProfiler.Instance.TotalMessagesQueued++; if (pumpMessage is PaintMessage) { CliProfiler.Instance.PaintMessagesQueued++; } #endif } }
private void TryWork(PumpMessage work) { try { work.Execute(); } catch (Exception ex) { PumpExceptionArgs exceptionArgs = new PumpExceptionArgs(ex); PumpException.Fire(exceptionArgs); if (exceptionArgs.Handled == false) { throw; } } #if PROFILING CliProfiler.Instance.TotalMessagesProcessed++; #endif }
protected void QueueActionInFront(Action a) { var pumpMessage = new PumpMessage(a); QueueActionInFront(pumpMessage); }
/// <summary> /// Queues the given action for processing on the pump thread /// </summary> /// <param name="a">the action that will be processed in order on the pump thread</param> public void QueueAction(Action a) { var pumpMessage = new PumpMessage(a); QueueAction(pumpMessage); }