コード例 #1
0
 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));
 }
コード例 #2
0
            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);
                }
            }
コード例 #3
0
            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);
                }
            }
コード例 #4
0
 public CallbackState(ParallelAsyncResult <TWorkItem> asyncResult, TWorkItem data)
 {
     this.AsyncResult = asyncResult;
     this.AsyncData   = data;
 }