예제 #1
0
 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);
 }
예제 #2
0
 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
     });
 }