Exemplo n.º 1
0
 /// <summary>
 /// Throws OperationCanceledByCallerException when ct is canceled by caller, e.g. caller canceled the previous CancellationToken
 /// in order to initiate a new call
 /// Throws CallerOperationTimeoutException when the caller couldn't not get response withing timeout
 /// </summary>
 /// <param name="ct"></param>
 /// <param name="taskFunc"></param>
 /// <param name="millisecondsTimeout"></param>
 /// <returns></returns>
 public static Task <T> TimeoutAsync <T>(this CancellationToken ct, Func <CancellationToken, Task <T> > taskFunc, double millisecondsTimeout)
 {
     return(ct.TimeoutAsync(taskFunc, TimeSpan.FromMilliseconds(millisecondsTimeout)));
 }