mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 14:16:07 +08:00
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
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user