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