Exemplo n.º 1
0
            /// <summary>
            /// Constructor.
            /// </summary>
            public TargetInfo(string invokerName, object target, FastInvokeHelper.FastInvokeHandlerDelegate delegateInstance,
                              bool poolAsFirstParameter, ThreadPoolFast pool, params object[] args)
            {
                DelegateInstance = delegateInstance;
                Target           = target;
                InvokerName      = invokerName;

                if (poolAsFirstParameter)
                {
                    Args = new object[] { pool, args };
                }
                else
                {
                    Args = args;
                }

                //if (args != null && args.Length == 1)
                //{// Single parameter pass.
                //    Args = new object[] { pool, args[0] };
                //}
                //else
                //{
                //    Args = new object[] { pool, args };
                //}
            }
        public void Dispose()
        {
            Stop();

            ThreadPoolFast.StopThread(_workerInternalThread, true, 200, 500);

            //if (_workerInternalThread != null && _workerInternalThread.ThreadState == ThreadState.Running)
            //{
            //    // Allow a few ms for the thread to try and stop as it should.
            //    Thread.Sleep(500);

            //    if (_workerInternalThread.ThreadState == ThreadState.Running)
            //    {
            //        SystemMonitor.Warning("Aborting background message processing thread.");
            //        _workerInternalThread.Abort();
            //    }
            //}
        }
            /// <summary>
            /// Constructor.
            /// </summary>
            public TargetInfo(string invokerName, object target, FastInvokeHelper.FastInvokeHandlerDelegate delegateInstance,
                bool poolAsFirstParameter, ThreadPoolFast pool, params object[] args)
            {
                DelegateInstance = delegateInstance;
                Target = target;
                InvokerName = invokerName;

                if (poolAsFirstParameter)
                {
                    Args = new object[] { pool, args };
                }
                else
                {
                    Args = args;
                }

                //if (args != null && args.Length == 1)
                //{// Single parameter pass.
                //    Args = new object[] { pool, args[0] };
                //}
                //else
                //{
                //    Args = new object[] { pool, args };
                //}
            }