aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Watchdog.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-10-25 20:49:46 +0100
committerJustin Clark-Casey (justincc)2011-10-25 20:49:46 +0100
commit968cae6c17fab8aa8a15bfd8231b50873aa6e794 (patch)
tree2c0f09c964f18a6b4a0977d9ac59afc84e556d9f /OpenSim/Framework/Watchdog.cs
parentMake OpenSim.Framework.Servers.HttpServer rely on OpenSim.Framework instead o... (diff)
downloadopensim-SC-968cae6c17fab8aa8a15bfd8231b50873aa6e794.zip
opensim-SC-968cae6c17fab8aa8a15bfd8231b50873aa6e794.tar.gz
opensim-SC-968cae6c17fab8aa8a15bfd8231b50873aa6e794.tar.bz2
opensim-SC-968cae6c17fab8aa8a15bfd8231b50873aa6e794.tar.xz
Add "threads abort <thread-id>" simulator console command that allows us to abort a watchdog managed thread.
This is for diagnostic purposes.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Watchdog.cs25
1 files changed, 23 insertions, 2 deletions
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
112 /// <summary> 112 /// <summary>
113 /// Stops watchdog tracking on the current thread 113 /// Stops watchdog tracking on the current thread
114 /// </summary> 114 /// </summary>
115 /// <returns>True if the thread was removed from the list of tracked 115 /// <returns>
116 /// threads, otherwise false</returns> 116 /// True if the thread was removed from the list of tracked
117 /// threads, otherwise false
118 /// </returns>
117 public static bool RemoveThread() 119 public static bool RemoveThread()
118 { 120 {
119 return RemoveThread(Thread.CurrentThread.ManagedThreadId); 121 return RemoveThread(Thread.CurrentThread.ManagedThreadId);
@@ -133,6 +135,25 @@ namespace OpenSim.Framework
133 return m_threads.Remove(threadID); 135 return m_threads.Remove(threadID);
134 } 136 }
135 137
138 public static bool AbortThread(int threadID)
139 {
140 lock (m_threads)
141 {
142 if (m_threads.ContainsKey(threadID))
143 {
144 ThreadWatchdogInfo twi = m_threads[threadID];
145 twi.Thread.Abort();
146 RemoveThread(threadID);
147
148 return true;
149 }
150 else
151 {
152 return false;
153 }
154 }
155 }
156
136 private static void UpdateThread(int threadID) 157 private static void UpdateThread(int threadID)
137 { 158 {
138 ThreadWatchdogInfo threadInfo; 159 ThreadWatchdogInfo threadInfo;