protected override async Task StartTask(CancellationToken token) { _consumerBlock = new ActionBlock <T>(item => { OnItemAvailable?.Invoke(item); }); _propagationBlock = CreatePropagationBlock(); _propagationBlock.LinkTo(_consumerBlock, new DataflowLinkOptions { PropagateCompletion = true }); await DoWork(token); }
public PrioritizedQueueServiceTask(string name, int idleTimeinSeconds = 10) : base(name) { _idleTimeInSeconds = idleTimeinSeconds; _loopWaitHandleList = new Dictionary <int, TaskEventWaitHandle>(); _consumerBlock = new ActionBlock <T>(item => { OnItemAvailable?.Invoke(item); }); _propagationBlock = CreatePropagationBlock(); _propagationBlock.LinkTo(_consumerBlock, new DataflowLinkOptions { PropagateCompletion = true }); }