* Moved all events except gridcomms and regioncomms over to Event Delegate instances to prevent event race conditions

ThreadPoolClientBranch
Teravus Ovares 2008-02-22 19:45:28 +00:00
parent 2ceee79905
commit e803d2f3f6
7 changed files with 41 additions and 20 deletions

View File

@ -475,6 +475,7 @@ namespace OpenSim.Region.Capabilities
public class AssetUploader public class AssetUploader
{ {
public event UpLoadedAsset OnUpLoad; public event UpLoadedAsset OnUpLoad;
private UpLoadedAsset handler001 = null;
private string uploaderPath = String.Empty; private string uploaderPath = String.Empty;
private LLUUID newAssetID; private LLUUID newAssetID;
@ -528,10 +529,10 @@ namespace OpenSim.Region.Capabilities
{ {
SaveAssetToFile(m_assetName + ".jp2", data); SaveAssetToFile(m_assetName + ".jp2", data);
} }
handler001 = OnUpLoad;
if (OnUpLoad != null) if (handler001 != null)
{ {
OnUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); handler001(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType);
} }
return res; return res;
@ -568,6 +569,8 @@ namespace OpenSim.Region.Capabilities
{ {
public event UpdateItem OnUpLoad; public event UpdateItem OnUpLoad;
private UpdateItem handler001 = null;
private string uploaderPath = String.Empty; private string uploaderPath = String.Empty;
private LLUUID inventoryItemID; private LLUUID inventoryItemID;
private BaseHttpServer httpListener; private BaseHttpServer httpListener;
@ -595,10 +598,10 @@ namespace OpenSim.Region.Capabilities
string res = String.Empty; string res = String.Empty;
LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
LLUUID assetID = LLUUID.Zero; LLUUID assetID = LLUUID.Zero;
handler001 = OnUpLoad;
if (OnUpLoad != null) if (handler001 != null)
{ {
assetID = OnUpLoad(inv, data); assetID = handler001(inv, data);
} }
uploadComplete.new_asset = assetID.ToString(); uploadComplete.new_asset = assetID.ToString();
@ -648,6 +651,8 @@ namespace OpenSim.Region.Capabilities
{ {
public event UpdateTaskScript OnUpLoad; public event UpdateTaskScript OnUpLoad;
private UpdateTaskScript handler001 = null;
private string uploaderPath = String.Empty; private string uploaderPath = String.Empty;
private LLUUID inventoryItemID; private LLUUID inventoryItemID;
private LLUUID primID; private LLUUID primID;
@ -688,9 +693,10 @@ namespace OpenSim.Region.Capabilities
string res = String.Empty; string res = String.Empty;
LLSDTaskInventoryUploadComplete uploadComplete = new LLSDTaskInventoryUploadComplete(); LLSDTaskInventoryUploadComplete uploadComplete = new LLSDTaskInventoryUploadComplete();
if (OnUpLoad != null) handler001 = OnUpLoad;
if (handler001 != null)
{ {
OnUpLoad(inventoryItemID, primID, isScriptRunning, data); handler001(inventoryItemID, primID, isScriptRunning, data);
} }
uploadComplete.item_id = inventoryItemID; uploadComplete.item_id = inventoryItemID;

View File

@ -51,6 +51,8 @@ namespace OpenSim.Grid.UserServer
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public event UserLoggedInAtLocation OnUserLoggedInAtLocation; public event UserLoggedInAtLocation OnUserLoggedInAtLocation;
private UserLoggedInAtLocation handler001 = null;
public UserConfig m_config; public UserConfig m_config;
@ -214,9 +216,10 @@ namespace OpenSim.Grid.UserServer
// Send // Send
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
if (OnUserLoggedInAtLocation != null) handler001 = OnUserLoggedInAtLocation;
if (handler001 != null)
{ {
OnUserLoggedInAtLocation(theUser.UUID, theUser.currentAgent.sessionID, theUser.currentAgent.currentRegion, theUser.currentAgent.currentHandle, theUser.currentAgent.currentPos); handler001(theUser.UUID, theUser.currentAgent.sessionID, theUser.currentAgent.currentRegion, theUser.currentAgent.currentHandle, theUser.currentAgent.currentPos);
} }
} }

View File

@ -47,6 +47,7 @@ namespace OpenSim.Region.Environment.Scenes
#region Events #region Events
public event PhysicsCrash UnRecoverableError; public event PhysicsCrash UnRecoverableError;
private PhysicsCrash handler001 = null;
#endregion #endregion
@ -715,9 +716,10 @@ namespace OpenSim.Region.Environment.Scenes
public void physicsBasedCrash() public void physicsBasedCrash()
{ {
if (UnRecoverableError != null) handler001 = UnRecoverableError;
if (handler001 != null)
{ {
UnRecoverableError(); handler001();
} }
} }

View File

@ -160,7 +160,9 @@ namespace OpenSim.Region.Environment.Scenes
public virtual void Restart(int seconds) public virtual void Restart(int seconds)
{ {
m_log.Error("[REGION]: passing Restart Message up the namespace"); m_log.Error("[REGION]: passing Restart Message up the namespace");
OnRestart(RegionInfo); restart handler001 = OnRestart;
if (handler001 != null)
handler001(RegionInfo);
} }
public virtual bool PresenceChildStatus(LLUUID avatarID) public virtual bool PresenceChildStatus(LLUUID avatarID)
@ -195,4 +197,4 @@ namespace OpenSim.Region.Environment.Scenes
#endregion #endregion
} }
} }

View File

@ -54,6 +54,7 @@ namespace OpenSim.Region.Environment.Scenes
protected ulong m_regionHandle; protected ulong m_regionHandle;
public event PrimCountTaintedDelegate OnPrimCountTainted; public event PrimCountTaintedDelegate OnPrimCountTainted;
private PrimCountTaintedDelegate handler001 = null;
/// <summary> /// <summary>
/// Signal whether the non-inventory attributes of any prims in the group have changed /// Signal whether the non-inventory attributes of any prims in the group have changed
@ -1525,9 +1526,10 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public void TriggerTainted() public void TriggerTainted()
{ {
if (OnPrimCountTainted != null) handler001 = OnPrimCountTainted;
if (handler001 != null)
{ {
OnPrimCountTainted(); handler001();
} }
} }

View File

@ -116,6 +116,8 @@ namespace OpenSim.Region.Environment.Scenes
private readonly List<ulong> m_knownChildRegions = new List<ulong>(); private readonly List<ulong> m_knownChildRegions = new List<ulong>();
//neighbouring regions we have enabled a child agent in //neighbouring regions we have enabled a child agent in
private SignificantClientMovement handler001 = null; //OnSignificantClientMovement;
/// <summary> /// <summary>
/// Implemented Control Flags /// Implemented Control Flags
@ -1482,9 +1484,10 @@ namespace OpenSim.Region.Environment.Scenes
if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > 0.5) if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > 0.5)
{ {
posLastSignificantMove = AbsolutePosition; posLastSignificantMove = AbsolutePosition;
if (OnSignificantClientMovement != null)
if (handler001 != null)
{ {
OnSignificantClientMovement(m_controllingClient); handler001(m_controllingClient);
m_scene.NotifyMyCoarseLocationChange(); m_scene.NotifyMyCoarseLocationChange();
} }
} }

View File

@ -39,6 +39,8 @@ namespace OpenSim.Region.Environment.Scenes
public event SendStatResult OnSendStatsResult; public event SendStatResult OnSendStatsResult;
private SendStatResult handler001 = null;
private enum Stats : uint private enum Stats : uint
{ {
TimeDilation = 0, TimeDilation = 0,
@ -245,9 +247,10 @@ namespace OpenSim.Region.Environment.Scenes
statpack.Stat = sb; statpack.Stat = sb;
if (OnSendStatsResult != null) handler001 = OnSendStatsResult;
if (handler001 != null)
{ {
OnSendStatsResult(statpack); handler001(statpack);
} }
resetvalues(); resetvalues();
m_report.Enabled = true; m_report.Enabled = true;