示例#1
0
        private WaitHandle GetWaitHandle()
        {
            var cb = new TimerCallback(new Action <object>((stateInfo) => {
                AsyncResult.IsCompleted = true;
                Callback.DynamicInvoke(AsyncResult);
            }));
            AutoResetEvent autoEvent = new AutoResetEvent(false);

            AsyncTimer = new System.Threading.Timer(cb, autoEvent, ResponseTime, System.Threading.Timeout.Infinite);
            return(autoEvent);
        }
示例#2
0
        //This method is called on the worker thread to execute the method
        internal void CallBack()
        {
            try
            {
                MethodReturnedValue = fMethod.DynamicInvoke(fArgs);
            }
            catch
            {
            }
            //Method is done. Signal the world
            fEvent.Set();
            if (fCallback != null)
            {
                try
                {
                    fCallback.DynamicInvoke(this);
                }
                catch
                {
                }
            }

            Completed = true;
        }