dont fire a thread on npc creation keeping the main one just waiting

avinationmerge
UbitUmarov 2014-08-02 18:57:43 +01:00
parent 74447d14cd
commit 01981fdf58
1 changed files with 6 additions and 5 deletions

View File

@ -170,9 +170,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
} }
*/ */
ManualResetEvent ev = new ManualResetEvent(false); // ManualResetEvent ev = new ManualResetEvent(false);
Util.FireAndForget(delegate(object x) { // Util.FireAndForget(delegate(object x) {
lock (m_avatars) lock (m_avatars)
{ {
scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd);
@ -181,15 +181,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC
ScenePresence sp; ScenePresence sp;
if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
{ {
sp.CompleteMovement(npcAvatar, false); sp.CompleteMovement(npcAvatar, false);
m_avatars.Add(npcAvatar.AgentId, npcAvatar); m_avatars.Add(npcAvatar.AgentId, npcAvatar);
// m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name); // m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name);
} }
} }
ev.Set(); // ev.Set();
}); // });
ev.WaitOne(); // ev.WaitOne();
// m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId); // m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId);