Exemplo n.º 1
0
        private static void AsyncUpdateThread(object obj)
        {
        #if !NETFX_CORE && !UNITY_WEBGL
            KeyValuePair <object, int> pair = (KeyValuePair <object, int>)obj;
            WorkerThreadPool           pool = ( WorkerThreadPool )pair.Key;
            int id = ( int )pair.Value;

            while (true)
            {
                try
                {
                    pool.m_threadPoolContinueSignals[id].WaitOne();

                    if (pool.m_threadPoolTerminateSignal.WaitOne(0))
                    {
                        break;
                    }

                    while (true)
                    {
                        MotionState state = null;

                        lock (pool.m_threadStateQueueLocks[id])
                        {
                            if (pool.m_threadStateQueues[id].Count > 0)
                            {
                                state = pool.m_threadStateQueues[id].Dequeue();
                            }
                        }

                        if (state != null)
                        {
                            state.AsyncUpdate();
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                catch (System.Exception e)
                {
                    if (e.GetType() != typeof(ThreadAbortException))
                    {
                        Debug.LogWarning(e);
                    }
                }
            }
        #endif
        }
Exemplo n.º 2
0
        private static void AsyncUpdateThread(object obj)
        {
            KeyValuePair <object, int> keyValuePair     = (KeyValuePair <object, int>)obj;
            WorkerThreadPool           workerThreadPool = (WorkerThreadPool)keyValuePair.Key;
            int value = keyValuePair.Value;

            for (;;)
            {
                try
                {
                    workerThreadPool.m_threadPoolContinueSignals[value].WaitOne();
                    if (!workerThreadPool.m_threadPoolTerminateSignal.WaitOne(0))
                    {
                        for (;;)
                        {
                            MotionState motionState = null;
                            object      obj2        = workerThreadPool.m_threadStateQueueLocks[value];
                            lock (obj2)
                            {
                                if (workerThreadPool.m_threadStateQueues[value].Count > 0)
                                {
                                    motionState = workerThreadPool.m_threadStateQueues[value].Dequeue();
                                }
                            }
                            if (motionState == null)
                            {
                                break;
                            }
                            motionState.AsyncUpdate();
                        }
                        continue;
                    }
                }
                catch (Exception ex)
                {
                    if (ex.GetType() != typeof(ThreadAbortException))
                    {
                        Debug.LogWarning(ex);
                    }
                    continue;
                }
                break;
            }
        }
Exemplo n.º 3
0
        private static void AsyncUpdateCallback(object obj)
        {
            MotionState motionState = (MotionState)obj;

            motionState.AsyncUpdate();
        }