示例#1
0
 protected IteratorAsyncResult <TIteratorAsyncResult> .AsyncStep CallTask(Func <TIteratorAsyncResult, TimeSpan, Task> taskFunc, IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy policy)
 {
     return(this.CallAsync((TIteratorAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => {
         Task task = taskFunc(thisPtr, t);
         if (task.Status == TaskStatus.Created)
         {
             task.Start();
         }
         return task.ToAsyncResult(c, s);
     }, (TIteratorAsyncResult thisPtr, IAsyncResult r) => TaskHelpers.EndAsyncResult(r), policy));
 }