DoWork() private method

private DoWork ( ) : void
return void
Example #1
0
        private void Work()
        {
#if XBOX
            int i = Interlocked.Increment(ref affinityIndex) - 1;
            int affinity = ThreadPool.XboxProcessorAffinity[i % ThreadPool.XboxProcessorAffinity.Length];
            Thread.CurrentThread.SetProcessorAffinity((int)affinity);
#endif

            Task task = new Task();
            while (true)
            {
                if (_tasks.LocalPop(ref task))
                {
                    task.DoWork();
                    try { task.DoWork(); }
                    catch (Exception e) { Debug.WriteLine(e); throw; }
                }
                else
                    FindWork();
            }
        }
Example #2
0
        private void WorkLoop()
        {
            while (true)
            {
                resetEvent.WaitOne();
                work.DoWork();

                lock (idleWorkers)
                {
                    idleWorkers.Push(this);
                }
            }
        }
Example #3
0
        private void Work()
        {
#if XBOX
            int i        = Interlocked.Increment(ref affinityIndex) - 1;
            int affinity = ThreadPool.XboxProcessorAffinity[i % ThreadPool.XboxProcessorAffinity.Length];
            Thread.CurrentThread.SetProcessorAffinity((int)affinity);
#endif

            Task task = new Task();
            while (true)
            {
                if (_tasks.LocalPop(ref task))
                {
                    task.DoWork();
                    try { task.DoWork(); }
                    catch (Exception e) { Debug.WriteLine(e); throw; }
                }
                else
                {
                    FindWork();
                }
            }
        }