protected AsyncStep CallTask(Func <TIteratorAsyncResult, TimeSpan, Task> taskFunc, ExceptionPolicy policy) { return(this.CallAsync( (thisPtr, t, c, s) => { var task = taskFunc(thisPtr, t); if (task.Status == TaskStatus.Created) { // User func might have created a Task without starting. // This can potentially hang threads. task.Start(); } return task.ToAsyncResult(c, s); }, (thisPtr, r) => TaskHelpers.EndAsyncResult(r), policy)); }
public static void EndWrite(this Stream stream, IAsyncResult asyncResult) { TaskHelpers.EndAsyncResult(asyncResult); }
public static void EndAuthenticateAsServer(this SslStream sslStream, IAsyncResult asyncResult) { TaskHelpers.EndAsyncResult(asyncResult); }
public static int EndRead(this Stream stream, IAsyncResult asyncResult) { return(TaskHelpers.EndAsyncResult <int>(asyncResult)); }