AdvancedMultithreadingLab.TestInterlocked.ThreadMain C# (CSharp) Метод

ThreadMain() приватный Метод

private ThreadMain ( object state ) : void
state object
Результат void
        private void ThreadMain( object state )
        {
            int processorId = (int) state;
            if ( processorId < 0 ) return;
            SetThreadAffinityMask( GetCurrentThread(), (IntPtr) (1 << processorId) );

            // If the new thread affinity mask does not specify the processor
            // that is currently running the thread, the thread is rescheduled on one of the allowable processors.

            for ( int i = 0; i < n; i++ )
            {
                Interlocked.Increment( ref this.field );
            }
        }