BEPUphysics.Threading.ThreadTaskManager.WorkerThread.ThreadExecutionLoop C# (CSharp) Метод

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

Thrown when the thread encounters an invalid state; generally propagated float.NaN's.
private ThreadExecutionLoop ( ) : void
Результат void
            private void ThreadExecutionLoop()
            {
                //Perform any initialization requested.
                if (threadStart != null)
                    threadStart(initializationInformation);
                TaskEntry task;

                while (true)
                {
                    resetEvent.WaitOne();
                    while (true)
                    {
                        if (!taskData.TryDequeueFirst(out task))
                        {
                            bool gotSomething = false;
                            for (int i = 1; i < manager.workers.Count; i++)
                            {
                                if (TrySteal((index + i) % manager.workers.Count, out task))
                                {
                                    gotSomething = true;
                                    break;
                                }
                            }
                            if (!gotSomething)
                                break; //Nothing to steal and I'm broke! Guess I'll mosey on out
                        }
                        try
                        {
                            if (task.Task != null)
                                task.Task(task.Info);
                            if (Interlocked.Decrement(ref manager.tasksRemaining) == 0)
                            {
                                manager.allThreadsIdleNotifier.Set();
                            }
                            if (task.Task == null)
                                return;
                        }
                        catch (ArithmeticException arithmeticException)
                        {
                            throw new ArithmeticException(
                                "Some internal multithreaded arithmetic has encountered an invalid state.  Check for invalid entity momentums, velocities, and positions; propagating NaN's will generally trigger this exception in the getExtremePoint function.",
                                arithmeticException);
                        }
                    }
                }
            }