Add proper method doc and comments to m_dataPresentEvent (from d9d9959)

cpu-performance
Justin Clark-Casey (justincc) 2013-07-23 00:51:59 +01:00
parent ff294dce6c
commit 511801c607
1 changed files with 13 additions and 2 deletions

View File

@ -223,6 +223,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>Flag to signal when clients should send pings</summary>
protected bool m_sendPing;
/// <summary>
/// Event used to signal when queued packets are available for sending.
/// </summary>
/// <remarks>
/// This allows the outbound loop to only operate when there is data to send rather than continuously polling.
/// Some data is sent immediately and not queued. That data would not trigger this event.
/// </remarks>
private AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false);
private Pool<IncomingPacket> m_incomingPacketPool;
/// <summary>
@ -881,11 +890,10 @@ 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>
@ -1900,6 +1908,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// token bucket could get more tokens
//if (!m_packetSent)
// Thread.Sleep((int)TickCountResolution);
//
// Instead, now wait for data present to be explicitly signalled. Evidence so far is that with
// modern mono it reduces CPU base load since there is no more continuous polling.
m_dataPresentEvent.WaitOne(100);
Watchdog.UpdateThread();