private Task InternalScheduleRepeatedly(int initialDelayMs, int intervalMs, Func <bool> action, CancellationToken token) { if (initialDelayMs == Timeout.Infinite) { return(TaskExt.CreateInfiniteTask()); } return(InternalScheduleRepeatedlyAsync(initialDelayMs, intervalMs, action, token)); }
private Task InternalScheduleOnce(int initialDelayMs, Action action, CancellationToken token) { if (initialDelayMs == Timeout.Infinite) { return(TaskExt.CreateInfiniteTask()); } if (initialDelayMs <= 0) { action(); return(TaskExt.CreateCompletedTask()); } return(Task.Delay(initialDelayMs, token).Then(t => action())); }