public ThreadTriggeredTaskRunHeartbeat(Stopwatch stopwatch, DedicatedThreadHeartbeatEventSource dedicatedThreadHeartbeatEventSource) : base(stopwatch) { HeartbeatOn = true; dedicatedThreadHeartbeatEventSource.Heartbeat += (s, e) => { if (HeartbeatOn) { Task.Run(() => DoHeartbeat()); } }; }
public ThreadTriggeredSynchronousHeartbeat(Stopwatch stopwatch, DedicatedThreadHeartbeatEventSource dedicatedThreadHeartbeatEventSource) : base(stopwatch) { HeartbeatOn = true; dedicatedThreadHeartbeatEventSource.Heartbeat += (s, e) => { if (HeartbeatOn) { DoHeartbeat(); } }; }
public ThreadTriggeredQueueJumpingHeartbeat(Stopwatch stopwatch, QueueJumpableTaskScheduler queueJumpableTaskScheduler, DedicatedThreadHeartbeatEventSource dedicatedThreadHeartbeatEventSource) : base(stopwatch) { this.queueJumpableTaskScheduler = queueJumpableTaskScheduler; HeartbeatOn = true; dedicatedThreadHeartbeatEventSource.Heartbeat += (s, e) => { if (HeartbeatOn) { Task.Factory.StartNew( () => DoHeartbeat(), CancellationToken.None, TaskCreationOptions.None, queueJumpableTaskScheduler.FrontOfQueue); } }; }