public static async ReusableTask <T> WithTimeout <T> (this ReusableTask <T> task, string message) { var t = task.AsTask(); if (await Task.WhenAny(Task.Delay(Timeout), t) != t) { Assert.Fail("The task timed out. {0}", message); } return(await t); }
public static Task <T> WithTimeout <T> (this ReusableTask <T> task, int timeout, string message = null) => task.AsTask().WithTimeout(TimeSpan.FromMilliseconds(timeout), message);
public static Task <T> WithTimeout <T> (this ReusableTask <T> task, string message = null) => task.AsTask().WithTimeout(message);
public static Task WithTimeout(this ReusableTask task, TimeSpan timeout, string message = null) => task.AsTask().WithTimeout(timeout, message);