Beispiel #1
0
        public static async Task <AsyncCompletedEventArgs> Start(Action action, CancellationToken token, int timeout = Timeout.Infinite)
        {
            var task = new TimeoutTask(action, token, timeout);

            return(await task.Run());
        }
Beispiel #2
0
 public static async Task <AsyncCompletedEventArgs> Start(Action action, int timeout)
 {
     return(await TimeoutTask.Start(action, CancellationToken.None, timeout));
 }
Beispiel #3
0
 public static async Task <AsyncCompletedEventArgs> Start(Action action, TimeSpan timeout)
 {
     return(await TimeoutTask.Start(action, CancellationToken.None, (int)timeout.TotalMilliseconds));
 }
Beispiel #4
0
 public static async Task <AsyncCompletedEventArgs> Start(Action action, CancellationToken token)
 {
     return(await TimeoutTask.Start(action, token, Timeout.Infinite));
 }