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);
        }
Example #2
0
 public static Task <T> WithTimeout <T> (this ReusableTask <T> task, int timeout, string message = null)
 => task.AsTask().WithTimeout(TimeSpan.FromMilliseconds(timeout), message);
Example #3
0
 public static Task <T> WithTimeout <T> (this ReusableTask <T> task, string message = null)
 => task.AsTask().WithTimeout(message);
Example #4
0
 public static Task WithTimeout(this ReusableTask task, TimeSpan timeout, string message = null)
 => task.AsTask().WithTimeout(timeout, message);