mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 14:16:07 +08:00
change threading on GetTexture and getMesh and WebFetch Modules.
This commit is contained in:
@@ -102,6 +102,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
private static DoubleQueue<aPollRequest> m_queue =
|
||||
new DoubleQueue<aPollRequest>();
|
||||
|
||||
private static int m_NumberScenes = 0;
|
||||
|
||||
#region ISharedRegionModule Members
|
||||
|
||||
public WebFetchInvDescModule() : this(true) {}
|
||||
@@ -145,17 +147,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
StatsManager.DeregisterStat(s_processedRequestsStat);
|
||||
StatsManager.DeregisterStat(s_queuedRequestsStat);
|
||||
|
||||
if (ProcessQueuedRequestsAsync)
|
||||
{
|
||||
if (m_workerThreads != null)
|
||||
{
|
||||
foreach (Thread t in m_workerThreads)
|
||||
Watchdog.AbortThread(t.ManagedThreadId);
|
||||
|
||||
m_workerThreads = null;
|
||||
}
|
||||
}
|
||||
|
||||
m_NumberScenes--;
|
||||
Scene = null;
|
||||
}
|
||||
|
||||
@@ -203,6 +195,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
Scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
|
||||
m_NumberScenes++;
|
||||
|
||||
int nworkers = 2; // was 2
|
||||
if (ProcessQueuedRequestsAsync && m_workerThreads == null)
|
||||
{
|
||||
@@ -225,7 +219,23 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
}
|
||||
|
||||
public void Close() { }
|
||||
public void Close()
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
if (ProcessQueuedRequestsAsync)
|
||||
{
|
||||
if (m_NumberScenes <= 0 && m_workerThreads != null)
|
||||
{
|
||||
m_log.DebugFormat("[WebFetchInvDescModule] Closing");
|
||||
foreach (Thread t in m_workerThreads)
|
||||
Watchdog.AbortThread(t.ManagedThreadId);
|
||||
|
||||
m_workerThreads = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string Name { get { return "WebFetchInvDescModule"; } }
|
||||
|
||||
@@ -350,6 +360,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
public void Process(aPollRequest requestinfo)
|
||||
{
|
||||
if(m_module == null || m_module.Scene == null || m_module.Scene.ShuttingDown)
|
||||
return;
|
||||
|
||||
UUID requestID = requestinfo.reqID;
|
||||
|
||||
Hashtable response = new Hashtable();
|
||||
@@ -425,31 +438,26 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
// }
|
||||
// }
|
||||
|
||||
private void DoInventoryRequests()
|
||||
private static void DoInventoryRequests()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Watchdog.UpdateThread();
|
||||
|
||||
WaitProcessQueuedInventoryRequest();
|
||||
}
|
||||
}
|
||||
aPollRequest poolreq = m_queue.Dequeue();
|
||||
|
||||
public void WaitProcessQueuedInventoryRequest()
|
||||
{
|
||||
aPollRequest poolreq = m_queue.Dequeue();
|
||||
|
||||
if (poolreq != null && poolreq.thepoll != null)
|
||||
{
|
||||
try
|
||||
if (poolreq != null && poolreq.thepoll != null)
|
||||
{
|
||||
poolreq.thepoll.Process(poolreq);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[INVENTORY]: Failed to process queued inventory request {0} for {1} in {2}. Exception {3}",
|
||||
poolreq.reqID, poolreq.presence != null ? poolreq.presence.Name : "unknown", Scene.Name, e);
|
||||
try
|
||||
{
|
||||
poolreq.thepoll.Process(poolreq);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[INVENTORY]: Failed to process queued inventory request {0} for {1}. Exception {3}",
|
||||
poolreq.reqID, poolreq.presence != null ? poolreq.presence.Name : "unknown", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user