예제 #1
0
        public ThreadTriggeredTaskRunHeartbeat(Stopwatch stopwatch, DedicatedThreadHeartbeatEventSource dedicatedThreadHeartbeatEventSource) : base(stopwatch)
        {
            HeartbeatOn = true;

            dedicatedThreadHeartbeatEventSource.Heartbeat += (s, e) => {
                if (HeartbeatOn)
                {
                    Task.Run(() => DoHeartbeat());
                }
            };
        }
예제 #2
0
        public ThreadTriggeredSynchronousHeartbeat(Stopwatch stopwatch, DedicatedThreadHeartbeatEventSource dedicatedThreadHeartbeatEventSource) : base(stopwatch)
        {
            HeartbeatOn = true;

            dedicatedThreadHeartbeatEventSource.Heartbeat += (s, e) => {
                if (HeartbeatOn)
                {
                    DoHeartbeat();
                }
            };
        }
예제 #3
0
        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);
                }
            };
        }