Undo "Revert "Small changes to threading to send thread names to unmanaged threads. Needs Mono 3.6+ to see thread names in utilities like top -H . Some formatting of the thread name to fin in the 16 byte limit on Linux. Please test on Windows to see if the work has any adverse effects.""

Fix for break in next commit

This reverts commit 376fab1402.
This commit is contained in:
BlueWall
2014-09-17 20:03:54 -04:00
parent 1f40630a9a
commit 96a2449122
5 changed files with 14 additions and 11 deletions

View File

@@ -87,7 +87,7 @@ namespace OpenSim.Framework.Monitoring
/// </summary>
public Stat Stat { get; set; }
public ThreadWatchdogInfo(Thread thread, int timeout)
public ThreadWatchdogInfo(Thread thread, int timeout, string name)
{
Thread = thread;
Timeout = timeout;
@@ -96,8 +96,8 @@ namespace OpenSim.Framework.Monitoring
Stat
= new Stat(
thread.Name,
string.Format("Last update of thread {0}", thread.Name),
name,
string.Format("Last update of thread {0}", name),
"",
"ms",
"server",
@@ -216,12 +216,11 @@ namespace OpenSim.Framework.Monitoring
bool alarmIfTimeout, Func<string> alarmMethod, int timeout, bool log = true)
{
Thread thread = new Thread(start);
thread.Name = name;
thread.Priority = priority;
thread.IsBackground = isBackground;
ThreadWatchdogInfo twi
= new ThreadWatchdogInfo(thread, timeout)
= new ThreadWatchdogInfo(thread, timeout, name)
{ AlarmIfTimeout = alarmIfTimeout, AlarmMethod = alarmMethod };
if (log)
@@ -230,8 +229,10 @@ namespace OpenSim.Framework.Monitoring
lock (m_threads)
m_threads.Add(twi.Thread.ManagedThreadId, twi);
thread.Start();
thread.Name = name;
return thread;
}