void DoWork(bool onlyRunContinuations = false) { try { var nextContinuationOrNull = _threadWorkerSynchronizationContext.GetNextContinuationOrNull(); // if there's a continuation to run, run it if (nextContinuationOrNull != null) { nextContinuationOrNull(); return; } var canTryToReceiveNewMessage = !onlyRunContinuations; if (canTryToReceiveNewMessage) { TryReceiveNewMessage(); } } catch (ThreadAbortException) { _log.Debug("Aborting worker {0}", Name); _keepWorking = false; } catch (Exception exception) { _log.Error(exception, "Error while attempting to do work"); } }
void DoWork(bool onlyRunContinuations = false) { try { var nextContinuationOrNull = _threadWorkerSynchronizationContext.GetNextContinuationOrNull(); if (nextContinuationOrNull != null) { nextContinuationOrNull(); return; } if (!onlyRunContinuations) { TryProcessMessage(); } } catch (ThreadAbortException) { _log.Debug("Aborting worker {0}", Name); _keepWorking = false; } catch (Exception exception) { _log.Error(exception, "Error while attempting to do work"); } }