예제 #1
0
 private static void Increase(IPollingTimeout timeout, int count)
 {
     for (var i = 0; i < count; i++)
     {
         timeout.Increase();
     }
 }
예제 #2
0
        private async Task PollingCycle(IPollingTimeout timeout, PollingFunction func, CancellationToken token)
        {
            await Task.Yield();

            while (!token.IsCancellationRequested)
            {
                if (await func(token).ContinueWith(OnJobFunctionCompleted))
                {
                    timeout.Reset();
                    await timeout.WaitAsync(token);
                }
                else
                {
                    await timeout.WaitAsync(token);

                    timeout.Increase();
                }
            }
        }