private void ExecuteTimerTask(TimerTask task) { try { task.Execute(); Interlocked.Exchange(ref task.completed, 1); Interlocked.Increment(ref TasksCompleted); } catch (Exception ex) { Interlocked.Exchange(ref task.exception, ex); } if (task is RepeatingTimerTask) { ReAddRepeatingTask(task as RepeatingTimerTask); } }