public AuroraThreadPool(AuroraThreadPoolStartInfo info)
 {
     m_info = info;
     Threads = new Thread[m_info.Threads];
     Sleeping = new int[m_info.Threads];
     nthreads = 0;
     nSleepingthreads = 0;
     // lets threads check for work a bit faster in case we have all sleeping and awake interrupt fails
 }
Example #2
0
 public AuroraThreadPool(AuroraThreadPoolStartInfo info)
 {
     m_info           = info;
     Threads          = new Thread[m_info.Threads];
     Sleeping         = new int[m_info.Threads];
     nthreads         = 0;
     nSleepingthreads = 0;
     // lets threads check for work a bit faster in case we have all sleeping and awake interrupt fails
 }
        public MaintenanceThread(ScriptEngine Engine)
        {
            m_ScriptEngine = Engine;
            EventManager = Engine.EventManager;

            RunInMainProcessingThread = Engine.Config.GetBoolean("RunInMainProcessingThread", false);

            RunInMainProcessingThread = false; // temporary false until code is fix to work with true

            //There IS a reason we start this, even if RunInMain is enabled
            // If this isn't enabled, we run into issues with the CmdHandlerQueue,
            // as it always must be async, so we must run the pool anyway
            AuroraThreadPoolStartInfo info = new AuroraThreadPoolStartInfo
                                                 {
                                                     priority = ThreadPriority.Normal,
                                                     Threads = 1,
                                                     MaxSleepTime = Engine.Config.GetInt("SleepTime", 100),
                                                     SleepIncrementTime = Engine.Config.GetInt("SleepIncrementTime", 1),
                                                     Name = "Script Cmd Thread Pools"
                                                 };
            cmdThreadpool = new AuroraThreadPool(info);
            info.Name = "Script Loading Thread Pools";
            scriptChangeThreadpool = new AuroraThreadPool(info);

            MaxScriptThreads = Engine.Config.GetInt("Threads", 100); // leave control threads out of user option
            AuroraThreadPoolStartInfo sinfo = new AuroraThreadPoolStartInfo
                                                  {
                                                      priority = ThreadPriority.Normal,
                                                      Threads = MaxScriptThreads,
                                                      MaxSleepTime = Engine.Config.GetInt("SleepTime", 100),
                                                      SleepIncrementTime = Engine.Config.GetInt("SleepIncrementTime", 1),
                                                      KillThreadAfterQueueClear = true,
                                                      Name = "Script Event Thread Pools"
                                                  };
            scriptThreadpool = new AuroraThreadPool(sinfo);

            AppDomain.CurrentDomain.AssemblyResolve += m_ScriptEngine.AssemblyResolver.OnAssemblyResolve;
        }
        public virtual void RegionLoaded(IScene scene)
        {
            if (!m_Enabled)
                return;

            AuroraThreadPoolStartInfo info = new AuroraThreadPoolStartInfo
                                                 {priority = ThreadPriority.Lowest, Threads = 1};
            threadpool = new AuroraThreadPool(info);
            blockthreadpool = new AuroraThreadPool(info);
        }