public AsyncCommandManager(IScriptEngine _ScriptEngine)
        {
            m_ScriptEngine = _ScriptEngine;

            // If there is more than one scene in the simulator or multiple script engines are used on the same region
            // then more than one thread could arrive at this block of code simultaneously.  However, it cannot be
            // executed concurrently both because concurrent list operations are not thread-safe and because of other
            // race conditions such as the later check of cmdHandlerThread == null.
            lock (staticLock)
            {
                if (m_ScriptEngines.Count == 0)
                    ReadConfig();

                if (!m_ScriptEngines.Contains(m_ScriptEngine))
                    m_ScriptEngines.Add(m_ScriptEngine);

                // Create instances of all plugins
                if (!m_Dataserver.ContainsKey(m_ScriptEngine))
                    m_Dataserver[m_ScriptEngine] = new Dataserver(this);
                if (!m_Timer.ContainsKey(m_ScriptEngine))
                    m_Timer[m_ScriptEngine] = new Timer(this);
                if (!m_HttpRequest.ContainsKey(m_ScriptEngine))
                    m_HttpRequest[m_ScriptEngine] = new HttpRequest(this);
                if (!m_Listener.ContainsKey(m_ScriptEngine))
                    m_Listener[m_ScriptEngine] = new Listener(this);
                if (!m_SensorRepeat.ContainsKey(m_ScriptEngine))
                    m_SensorRepeat[m_ScriptEngine] = new SensorRepeat(this);
                if (!m_XmlRequest.ContainsKey(m_ScriptEngine))
                    m_XmlRequest[m_ScriptEngine] = new XmlRequest(this);

                StartThread();
            }
        }
Example #2
0
        public AsyncCommandManager(IScriptEngine _ScriptEngine)
        {
            m_ScriptEngine = _ScriptEngine;
            m_Scene = m_ScriptEngine.World;

            if (m_Scenes.Count == 0)
                ReadConfig();

            if (!m_Scenes.Contains(m_Scene))
                m_Scenes.Add(m_Scene);
            if (!m_ScriptEngines.Contains(m_ScriptEngine))
                m_ScriptEngines.Add(m_ScriptEngine);

            // Create instances of all plugins
            if (!m_Dataserver.ContainsKey(m_ScriptEngine))
                m_Dataserver[m_ScriptEngine] = new Dataserver(this);
            if (!m_Timer.ContainsKey(m_ScriptEngine))
                m_Timer[m_ScriptEngine] = new Timer(this);
            if (!m_HttpRequest.ContainsKey(m_ScriptEngine))
                m_HttpRequest[m_ScriptEngine] = new HttpRequest(this);
            if (!m_Listener.ContainsKey(m_ScriptEngine))
                m_Listener[m_ScriptEngine] = new Listener(this);
            if (!m_SensorRepeat.ContainsKey(m_ScriptEngine))
                m_SensorRepeat[m_ScriptEngine] = new SensorRepeat(this);
            if (!m_XmlRequest.ContainsKey(m_ScriptEngine))
                m_XmlRequest[m_ScriptEngine] = new XmlRequest(this);

            StartThread();
        }