Exemplo n.º 1
0
        public uint EnQueue(_ThreadPoolWaitCallback tpcallBack)
        {
            uint tpCount = 0;
            bool flag    = false;
            bool flag2   = false;

            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
            }
            finally
            {
                RuntimeHelpers.PrepareConstrainedRegions();
                try
                {
                    Monitor.Enter(this.tpSync);
                    flag = true;
                }
                catch (Exception)
                {
                }
                if (flag)
                {
                    if (this.tpCount == 0)
                    {
                        flag2 = ThreadPool.SetAppDomainRequestActive();
                    }
                    this.tpCount++;
                    tpCount = this.tpCount;
                    if (this.tpHead == null)
                    {
                        this.tpHead = tpcallBack;
                        this.tpTail = tpcallBack;
                    }
                    else
                    {
                        this.tpTail._next = tpcallBack;
                        this.tpTail       = tpcallBack;
                    }
                    Monitor.Exit(this.tpSync);
                    if (flag2)
                    {
                        ThreadPool.SetNativeTpEvent();
                    }
                }
            }
            return(tpCount);
        }