Reinstate explicit starting and stopping of PollServiceRequestManager added in 3eee991
but removed in 7c0bfca
Do not rely on destructors to stop things. These fire at unpredictable times and cause problems such as http://opensimulator.org/mantis/view.php?id=6503 and most probably http://opensimulator.org/mantis/view.php?id=6668cpu-performance
parent
a2f1cd87f8
commit
32d1e50565
|
@ -1805,6 +1805,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
// Long Poll Service Manager with 3 worker threads a 25 second timeout for no events
|
||||
m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000);
|
||||
m_PollServiceManager.Start();
|
||||
HTTPDRunning = true;
|
||||
|
||||
//HttpListenerContext context;
|
||||
|
@ -1855,7 +1856,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
HTTPDRunning = false;
|
||||
try
|
||||
{
|
||||
// m_PollServiceManager.Stop();
|
||||
m_PollServiceManager.Stop();
|
||||
|
||||
m_httpListener2.ExceptionThrown -= httpServerException;
|
||||
//m_httpListener2.DisconnectHandler = null;
|
||||
|
|
|
@ -66,7 +66,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
m_server = pSrv;
|
||||
m_WorkerThreadCount = pWorkerThreadCount;
|
||||
m_workerThreads = new Thread[m_WorkerThreadCount];
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
//startup worker threads
|
||||
for (uint i = 0; i < m_WorkerThreadCount; i++)
|
||||
{
|
||||
|
@ -91,7 +94,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
1000 * 60 * 10);
|
||||
}
|
||||
|
||||
|
||||
private void ReQueueEvent(PollServiceHttpRequest req)
|
||||
{
|
||||
if (m_running)
|
||||
|
@ -142,14 +144,14 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
}
|
||||
|
||||
~PollServiceRequestManager()
|
||||
public void Stop()
|
||||
{
|
||||
m_running = false;
|
||||
// m_timeout = -10000; // cause all to expire
|
||||
Thread.Sleep(1000); // let the world move
|
||||
|
||||
foreach (Thread t in m_workerThreads)
|
||||
Watchdog.AbortThread(t.ManagedThreadId);
|
||||
Watchdog.AbortThread(t.ManagedThreadId);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue