* FireQueueEmpty now checks if a measurable amount of time has passed, and if not it sleeps for a small amount of time. This throttles OnQueueEmpty calls where there is no callback or the callback is doing very little work
* Changed HandleQueueEmpty()'s Monitor.TryEnter() calls to locks. We want to take our time in this function and do all the work necessary, since returning too fast will induce a sleep anywaysprioritization
parent
2752a3525c
commit
b06f258319
|
@ -3558,45 +3558,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
ProcessTextureRequests();
|
||||
break;
|
||||
case ThrottleOutPacketType.Task:
|
||||
if (Monitor.TryEnter(m_avatarTerseUpdates.SyncRoot))
|
||||
lock (m_avatarTerseUpdates.SyncRoot)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (m_avatarTerseUpdates.Count > 0)
|
||||
{
|
||||
|
||||
ProcessAvatarTerseUpdates();
|
||||
return;
|
||||
}
|
||||
}
|
||||
finally { Monitor.Exit(m_avatarTerseUpdates.SyncRoot); }
|
||||
if (m_avatarTerseUpdates.Count > 0)
|
||||
ProcessAvatarTerseUpdates();
|
||||
}
|
||||
break;
|
||||
case ThrottleOutPacketType.State:
|
||||
if (Monitor.TryEnter(m_primFullUpdates.SyncRoot))
|
||||
lock (m_primFullUpdates.SyncRoot)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (m_primFullUpdates.Count > 0)
|
||||
{
|
||||
ProcessPrimFullUpdates();
|
||||
return;
|
||||
}
|
||||
}
|
||||
finally { Monitor.Exit(m_primFullUpdates.SyncRoot); }
|
||||
if (m_primFullUpdates.Count > 0)
|
||||
ProcessPrimFullUpdates();
|
||||
}
|
||||
|
||||
if (Monitor.TryEnter(m_primTerseUpdates.SyncRoot))
|
||||
lock (m_primTerseUpdates.SyncRoot)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (m_primTerseUpdates.Count > 0)
|
||||
{
|
||||
ProcessPrimTerseUpdates();
|
||||
return;
|
||||
}
|
||||
}
|
||||
finally { Monitor.Exit(m_primTerseUpdates.SyncRoot); }
|
||||
if (m_primTerseUpdates.Count > 0)
|
||||
ProcessPrimTerseUpdates();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -10344,7 +10322,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
{
|
||||
if (lookup.Heap.ContainsHandle(lookup.Handle))
|
||||
lookup.Heap[lookup.Handle] =
|
||||
new MinHeapItem(priority, item.Value, item.LocalID);
|
||||
new MinHeapItem(priority, item.Value, item.LocalID, this.m_comparison);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -535,14 +535,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
ThrottleOutPacketType type = (ThrottleOutPacketType)i;
|
||||
QueueEmpty callback = OnQueueEmpty;
|
||||
|
||||
int start = Environment.TickCount;
|
||||
|
||||
if (callback != null)
|
||||
{
|
||||
try { callback(type); }
|
||||
catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + type + ") threw an exception: " + e.Message, e); }
|
||||
}
|
||||
|
||||
// HACK: Try spending some extra time here to slow down OnQueueEmpty calls
|
||||
//System.Threading.Thread.Sleep(100);
|
||||
// Make sure all queue empty calls take at least a measurable amount of time,
|
||||
// otherwise we'll peg a CPU trying to fire these too fast
|
||||
if (Environment.TickCount == start)
|
||||
System.Threading.Thread.Sleep((int)m_udpServer.TickCountResolution);
|
||||
|
||||
m_onQueueEmptyRunning[i] = false;
|
||||
}
|
||||
|
|
|
@ -125,10 +125,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
expiredPackets = new List<OutgoingPacket>();
|
||||
expiredPackets.Add(packet);
|
||||
}
|
||||
/*else
|
||||
{
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue