protected override void WaitForResult <T>(SyncCallback <T> callback) { int signaledIndex = WaitHandle.WaitAny(new[] { mDisconnectionWaitHandle, callback.WaitHandle }, Timeout.Infinite); if (signaledIndex == 0) { callback.SetException(mDisconnectionException); } base.WaitForResult(callback); }
private SyncCallback <T> InnerInvokeSync <T>(ICalleeProxyInterceptor interceptor, MethodInfo method, IOperationResultExtractor <T> extractor, object[] arguments, Type unwrapped) { MethodInfoHelper methodInfoHelper = new MethodInfoHelper(method); string procedureUri = interceptor.GetProcedureUri(method); SyncCallback <T> syncCallback = new SyncCallback <T>(procedureUri, methodInfoHelper, arguments, extractor); object[] argumentsToSend = methodInfoHelper.GetInputArguments(arguments); Invoke(interceptor, syncCallback, method, argumentsToSend); return(syncCallback); }
public T Invoke <T>(ICalleeProxyInterceptor interceptor, MethodInfo method, IOperationResultExtractor <T> extractor, object[] arguments) { Type unwrapped = TaskExtensions.UnwrapReturnType(method.ReturnType); SyncCallback <T> callback = InnerInvokeSync <T>(interceptor, method, extractor, arguments, unwrapped); WaitForResult(callback); Exception exception = callback.Exception; if (exception != null) { throw exception; } return(callback.OperationResult); }
protected virtual void WaitForResult <T>(SyncCallback <T> callback) { callback.Wait(Timeout.Infinite); }