Esempio n. 1
0
        internal void EnsureThreadRequested()
        {
            int num;

            for (int comparand = this.numOutstandingThreadRequests; comparand < ThreadPoolGlobals.processorCount; comparand = num)
            {
                num = Interlocked.CompareExchange(ref this.numOutstandingThreadRequests, comparand + 1, comparand);
                if (num == comparand)
                {
                    ThreadPool.RequestWorkerThread();
                    break;
                }
            }
        }
        internal void EnsureThreadRequested()
        {
            int num;

            for (int i = this.numOutstandingThreadRequests; i < ThreadPoolGlobals.processorCount; i = num)
            {
                num = Interlocked.CompareExchange(ref this.numOutstandingThreadRequests, i + 1, i);
                if (num == i)
                {
                    ThreadPool.RequestWorkerThread();
                    return;
                }
            }
        }
Esempio n. 3
0
        internal void EnsureThreadRequested()
        {
            //
            // If we have not yet requested #procs threads, then request a new thread.
            //
            int count = numOutstandingThreadRequests;

            while (count < ThreadPoolGlobals.processorCount)
            {
                int prev = Interlocked.CompareExchange(ref numOutstandingThreadRequests, count + 1, count);
                if (prev == count)
                {
                    ThreadPool.RequestWorkerThread();
                    break;
                }
                count = prev;
            }
        }