mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 08:55:56 +08:00
try Hacking in an AutoResetEvent to control the outgoing UDP loop instead of a continuous loop with sleeps.
Does appear to have a cpu impact but may need further tweaking
This commit is contained in:
committed by
Diva Canto
parent
71b1511db5
commit
d9d995914c
@@ -806,8 +806,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
|
||||
PacketPool.Instance.ReturnPacket(packet);
|
||||
m_dataPresentEvent.Set();
|
||||
|
||||
}
|
||||
|
||||
private AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false);
|
||||
|
||||
/// <summary>
|
||||
/// Start the process of sending a packet to the client.
|
||||
/// </summary>
|
||||
@@ -1658,6 +1662,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// Action generic every round
|
||||
Action<IClientAPI> clientPacketHandler = ClientOutgoingPacketHandler;
|
||||
|
||||
// while (true)
|
||||
while (base.IsRunningOutbound)
|
||||
{
|
||||
try
|
||||
@@ -1718,8 +1723,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
// If nothing was sent, sleep for the minimum amount of time before a
|
||||
// token bucket could get more tokens
|
||||
if (!m_packetSent)
|
||||
Thread.Sleep((int)TickCountResolution);
|
||||
//if (!m_packetSent)
|
||||
// Thread.Sleep((int)TickCountResolution);
|
||||
m_dataPresentEvent.WaitOne(100);
|
||||
|
||||
Watchdog.UpdateThread();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user