예제 #1
0
        /// <summary>
        /// Internal callback method that manages invoking
        /// the caller's callback (_callback) and does
        /// exception handling and signaling.
        /// </summary>
        /// <param name="state"></param>
        private void Callback(object state)
        {
            ThreadPoolOptions <T> callbackState = (ThreadPoolOptions <T>)state;

            try
            {
                callbackState.Callback(callbackState.State);
            }
            catch (Exception exception)
            {
                callbackState.ErrorCallback(exception, callbackState.State);
            }
            finally
            {
                this.SignalCompletion();
            }
        }
예제 #2
0
        private void Callback(object state)
        {
            ThreadPoolOptions <T> threadPoolOptions = (ThreadPoolOptions <T>)state;

            try
            {
                threadPoolOptions.Callback(threadPoolOptions.State);
            }
            catch (Exception arg)
            {
                threadPoolOptions.ErrorCallback(arg, threadPoolOptions.State);
            }
            finally
            {
                SignalCompletion();
            }
        }