Пример #1
0
        private bool ProcessQueueCommands()
        {
            OpenSim.Framework.LocklessQueue <Commands.ICommand> oldCurrentQueue = Interlocked.Exchange <OpenSim.Framework.LocklessQueue <Commands.ICommand> >(ref _currentCommandQueue, _waitingCommandQueue);

            try
            {
                if (oldCurrentQueue.Count == 0)
                {
                    _waitingCommandQueue = oldCurrentQueue;
                    return(false);
                }

                while (oldCurrentQueue.Count > 0)
                {
                    Commands.ICommand cmd;
                    if (oldCurrentQueue.Dequeue(out cmd))
                    {
                        //remember, each command that is executed from the queue may free other
                        //commands that are waiting on that command to complete. therefore, after executing
                        //each command from the current queue, we must check to see if new commands
                        //have been put into the freed queue, and execute those. this ensures proper
                        //ordering of commands relative to each object
                        DelayOrExecuteCommand(cmd);
                        ExecuteFreedCommands();
                    }
                }
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[PhysxScene]: ProcessQueueCommands exception:\n   {0}", e);
            }

            _waitingCommandQueue = oldCurrentQueue;


            return(true);
        }
Пример #2
0
        private bool ProcessQueueCommands()
        {
            OpenSim.Framework.LocklessQueue<Commands.ICommand> oldCurrentQueue = Interlocked.Exchange<OpenSim.Framework.LocklessQueue<Commands.ICommand>>(ref _currentCommandQueue, _waitingCommandQueue);

            try
            {
                if (oldCurrentQueue.Count == 0)
                {
                    _waitingCommandQueue = oldCurrentQueue;
                    return false;
                }

                while (oldCurrentQueue.Count > 0)
                {
                    Commands.ICommand cmd;
                    if (oldCurrentQueue.Dequeue(out cmd))
                    {
                        //remember, each command that is executed from the queue may free other
                        //commands that are waiting on that command to complete. therefore, after executing
                        //each command from the current queue, we must check to see if new commands
                        //have been put into the freed queue, and execute those. this ensures proper
                        //ordering of commands relative to each object
                        DelayOrExecuteCommand(cmd);
                        ExecuteFreedCommands();
                    }
                }
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[PhysxScene]: ProcessQueueCommands exception:\n   {0}", e);
            }

            _waitingCommandQueue = oldCurrentQueue;


            return true;
        }