コード例 #1
0
ファイル: ThreadPool.cs プロジェクト: cyberjaxx/OpenPDN
        public void QueueUserWorkItem(WaitCallback callback, object state)
        {
            IDisposable          token = Counter.AcquireToken();
            ThreadWrapperContext twc   = new ThreadWrapperContext(callback, state, token, ExceptionList);

            if (UseFXThreadPool)
            {
                System.Threading.ThreadPool.QueueUserWorkItem(new WaitCallback(twc.ThreadWrapper), twc);
            }
            else
            {
                Thread thread = new Thread(new ThreadStart(twc.ThreadWrapper));
                thread.IsBackground = true;
                thread.Start();
            }
        }
コード例 #2
0
        public void QueueUserWorkItem(WaitCallback callback, object state)
        {
            IDisposable          token = this.counter.AcquireToken();
            ThreadWrapperContext twc   = new ThreadWrapperContext(callback, state, token, this.exceptions);

            if (this.counter.Max == 1)
            {
                twc.ThreadWrapper(twc);
            }
            else if (this.useFXTheadPool)
            {
                ThreadPool.QueueUserWorkItem(new WaitCallback(twc.ThreadWrapper), twc);
            }
            else
            {
                Thread thread = new Thread(new ThreadStart(twc.ThreadWrapper));
                thread.IsBackground = true;
                thread.Start();
            }
        }
コード例 #3
0
ファイル: ThreadPool.cs プロジェクト: leejungho2/xynotecgui
        public void QueueUserWorkItem(WaitCallback callback, object state)
        {
            IDisposable token = counter.AcquireToken();
            ThreadWrapperContext twc = new ThreadWrapperContext(callback, state, token, this.exceptions);

            if (this.useFXTheadPool)
            {
                System.Threading.ThreadPool.QueueUserWorkItem(new WaitCallback(twc.ThreadWrapper), twc);
            }
            else
            {
                Thread thread = new Thread(new ThreadStart(twc.ThreadWrapper));
                thread.IsBackground = true;
                thread.Start();
            }
        }