From 968cae6c17fab8aa8a15bfd8231b50873aa6e794 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 25 Oct 2011 20:49:46 +0100 Subject: Add "threads abort " simulator console command that allows us to abort a watchdog managed thread. This is for diagnostic purposes. --- OpenSim/Framework/Watchdog.cs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework/Watchdog.cs') diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs index 0f34e83..c947ea6 100644 --- a/OpenSim/Framework/Watchdog.cs +++ b/OpenSim/Framework/Watchdog.cs @@ -112,8 +112,10 @@ namespace OpenSim.Framework /// /// Stops watchdog tracking on the current thread /// - /// True if the thread was removed from the list of tracked - /// threads, otherwise false + /// + /// True if the thread was removed from the list of tracked + /// threads, otherwise false + /// public static bool RemoveThread() { return RemoveThread(Thread.CurrentThread.ManagedThreadId); @@ -133,6 +135,25 @@ namespace OpenSim.Framework return m_threads.Remove(threadID); } + public static bool AbortThread(int threadID) + { + lock (m_threads) + { + if (m_threads.ContainsKey(threadID)) + { + ThreadWatchdogInfo twi = m_threads[threadID]; + twi.Thread.Abort(); + RemoveThread(threadID); + + return true; + } + else + { + return false; + } + } + } + private static void UpdateThread(int threadID) { ThreadWatchdogInfo threadInfo; -- cgit v1.1