Add "threads abort <thread-id>" simulator console command that allows us to abort a watchdog managed thread.

This is for diagnostic purposes.
This commit is contained in:
Justin Clark-Casey (justincc)
2011-10-25 20:49:46 +01:00
parent 8a0a78cbcc
commit 968cae6c17
2 changed files with 48 additions and 2 deletions

View File

@@ -192,6 +192,10 @@ namespace OpenSim.Framework.Servers
m_console.Commands.AddCommand("base", false, "show version",
"show version",
"Show server version", HandleShow);
m_console.Commands.AddCommand("base", false, "threads abort",
"threads abort <thread-id>",
"Abort a managed thread. Use \"show threads\" to find possible threads.", HandleThreadsAbort);
}
}
@@ -395,6 +399,27 @@ namespace OpenSim.Framework.Servers
break;
}
}
public virtual void HandleThreadsAbort(string module, string[] cmd)
{
if (cmd.Length != 3)
{
MainConsole.Instance.Output("Usage: threads abort <thread-id>");
return;
}
int threadId;
if (!int.TryParse(cmd[2], out threadId))
{
MainConsole.Instance.Output("ERROR: Thread id must be an integer");
return;
}
if (Watchdog.AbortThread(threadId))
MainConsole.Instance.OutputFormat("Aborted thread with id {0}", threadId);
else
MainConsole.Instance.OutputFormat("ERROR - Thread with id {0} not found in managed threads", threadId);
}
protected void ShowInfo()
{