protected AsyncStep CallParallelAsync <TWorkItem>(ICollection <TWorkItem> workItems, BeginCall <TWorkItem> beginCall, EndCall <TWorkItem> endCall, TimeSpan timeout, ExceptionPolicy policy) { return(this.CallAsync( (thisPtr, t, c, s) => new ParallelAsyncResult <TWorkItem>(thisPtr, workItems, beginCall, endCall, timeout, c, s), (thisPtr, r) => ParallelAsyncResult <TWorkItem> .End(r), policy)); }
static void OnCompleted(IAsyncResult ar) { CallbackState state = (CallbackState)ar.AsyncState; ParallelAsyncResult <TWorkItem> thisPtr = state.AsyncResult; try { thisPtr.endCall(thisPtr.iteratorAsyncResult, state.AsyncData, ar); thisPtr.TryComplete(null, false); } catch (Exception e) { thisPtr.TryComplete(e, false); } }
static void OnCompleted(IAsyncResult ar) { CallbackState state = (CallbackState)ar.AsyncState; ParallelAsyncResult <TWorkItem> thisPtr = state.AsyncResult; try { thisPtr.endCall(thisPtr.iteratorAsyncResult, state.AsyncData, ar); thisPtr.TryComplete(null, ar.CompletedSynchronously); } catch (Exception e) when(!Fx.IsFatal(e)) { thisPtr.TryComplete(e, ar.CompletedSynchronously); } }
public CallbackState(ParallelAsyncResult <TWorkItem> asyncResult, TWorkItem data) { this.AsyncResult = asyncResult; this.AsyncData = data; }