WaitHandle DoInvoke(MathFunctionToCall mathFunc, double value) { AsyncCallback cb = new AsyncCallback(MathCallback); IAsyncResult asyncResult = mathFunc.BeginInvoke(value, cb, mathFunc); return(asyncResult.AsyncWaitHandle); }
WaitHandle DoInvoke(MathFunctionToCall mathFunc, double value) { AsyncCallTracker callTracker = new AsyncCallTracker(mathFunc); AsyncCallback cb = new AsyncCallback(MathCallback); IAsyncResult asyncResult = mathFunc.BeginInvoke(value, cb, callTracker); return(callTracker.DoneEvent); }
public void CallMathCallback(MathFunctionToCall mathFunc, double start, double end, double increment) { AsyncCallback cb = new AsyncCallback(MathCallback); while (start < end) { Console.WriteLine("BeginInvoke: {0}", start); mathFunc.BeginInvoke(start, cb, mathFunc); start += increment; } }