From b2ed348aa2746fbf034b713d006e40366c479d5a Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 22 Oct 2009 12:33:23 -0700 Subject: Implemented a Watchdog class. Do not manually create Thread objects anymore, use Watchdog.StartThread(). While your thread is running call Watchdog.UpdateThread(). When it is shutting down call Watchdog.RemoveThread(). Most of the threads in OpenSim have been updated --- .../CoreModules/InterGrid/OpenGridProtocolModule.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs') diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index d636b1c..62500a2 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -1208,10 +1208,7 @@ namespace OpenSim.Region.CoreModules.InterGrid if (homeScene.TryGetAvatar(avatarId,out avatar)) { KillAUser ku = new KillAUser(avatar,mod); - Thread ta = new Thread(ku.ShutdownNoLogout); - ta.IsBackground = true; - ta.Name = "ShutdownThread"; - ta.Start(); + Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true); } } @@ -1261,7 +1258,13 @@ namespace OpenSim.Region.CoreModules.InterGrid avToBeKilled.ControllingClient.SendLogoutPacketWhenClosing = false; - Thread.Sleep(30000); + int sleepMS = 30000; + while (sleepMS > 0) + { + Watchdog.UpdateThread(); + Thread.Sleep(1000); + sleepMS -= 1000; + } // test for child agent because they might have come back if (avToBeKilled.IsChildAgent) @@ -1270,6 +1273,8 @@ namespace OpenSim.Region.CoreModules.InterGrid avToBeKilled.ControllingClient.Close(); } } + + Watchdog.RemoveThread(); } } -- cgit v1.1