After reading Timer.cs in the mono source, I'm not

convinced that timer.Enabled modification is thread safe.
I suspect the statsHeartBeat call to be one of our hot spots
because is tries to synchronize not with a lock, but by
disabling and enabling itself.  I've replaced that with a lock
in the hopes that this affects either the 100% bug, or the
invoke_void bugs.
0.6.0-stable
Sean Dague 2008-04-16 10:54:32 +00:00
parent ebb4ac6853
commit 1eb0fedd93
1 changed files with 117 additions and 115 deletions

View File

@ -138,8 +138,10 @@ namespace OpenSim.Region.Environment.Scenes
private void statsHeartBeat(object sender, EventArgs e) private void statsHeartBeat(object sender, EventArgs e)
{ {
m_report.Enabled = false; // Know what's not thread safe in Mono... modifying timers.
// System.Console.WriteLine("Firing Stats Heart Beat");
lock (m_report)
{
// Packet is already initialized and ready for data insert // Packet is already initialized and ready for data insert
@ -156,7 +158,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
statpack.Region.ObjectCapacity = (uint) objectCapacity; statpack.Region.ObjectCapacity = (uint) objectCapacity;
#region various statistic googly moogly #region various statistic googly moogly
// Our FPS is actually 10fps, so multiplying by 5 to get the amount that people expect there // Our FPS is actually 10fps, so multiplying by 5 to get the amount that people expect there
// 0-50 is pretty close to 0-45 // 0-50 is pretty close to 0-45
@ -176,7 +178,7 @@ namespace OpenSim.Region.Environment.Scenes
if (physfps < 0) if (physfps < 0)
physfps = 0; physfps = 0;
#endregion #endregion
//Our time dilation is 0.91 when we're running a full speed, //Our time dilation is 0.91 when we're running a full speed,
// therefore to make sure we get an appropriate range, // therefore to make sure we get an appropriate range,
@ -256,7 +258,7 @@ namespace OpenSim.Region.Environment.Scenes
handlerSendStatResult(statpack); handlerSendStatResult(statpack);
} }
resetvalues(); resetvalues();
m_report.Enabled = true; }
} }
private void resetvalues() private void resetvalues()