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()); }
public static async Task <AsyncCompletedEventArgs> Start(Action action, int timeout) { return(await TimeoutTask.Start(action, CancellationToken.None, timeout)); }
public static async Task <AsyncCompletedEventArgs> Start(Action action, TimeSpan timeout) { return(await TimeoutTask.Start(action, CancellationToken.None, (int)timeout.TotalMilliseconds)); }
public static async Task <AsyncCompletedEventArgs> Start(Action action, CancellationToken token) { return(await TimeoutTask.Start(action, token, Timeout.Infinite)); }