OpenSim/Framework/Monitoring/WorkManager.cs
/// <summary>
/// Start a new thread that is tracked by the watchdog
/// </summary>
/// <param name="start">The method that will be executed in a new thread</param>
/// <param name="name">A name to give to the new thread</param>
/// <param name="priority">Priority to run the thread at</param>
/// <param name="isBackground">True to run this thread as a background
/// thread, otherwise false</param>
/// <param name="alarmIfTimeout">Trigger an alarm function is we have timed out</param>
/// <param name="alarmMethod">
/// Alarm method to call if alarmIfTimeout is true and there is a timeout.
/// Normally, this will just return some useful debugging information.
/// </param>
/// <param name="timeout">Number of milliseconds to wait until we issue a warning about timeout.</param>
/// <param name="log">If true then creation of thread is logged.</param>
/// <returns>The newly created Thread object</returns>
Start a new thread that is tracked by the watchdog
Start a new thread that is tracked by the watchdog
public static Thread StartThread(
            ThreadStart start, string name, ThreadPriority priority, bool isBackground,
            bool alarmIfTimeout, Func<string> alarmMethod, int timeout, bool log = true)
        {
            Thread thread = new Thread(start);
            thread.Priority = priority;
            thread.IsBackground = isBackground;
            Watchdog.ThreadWatchdogInfo twi
                = new Watchdog.ThreadWatchdogInfo(thread, timeout, name)
            { AlarmIfTimeout = alarmIfTimeout, AlarmMethod = alarmMethod };
            Watchdog.AddThread(twi, name, log:log);
            thread.Start();
            thread.Name = name;
            return thread;
        }
public static Thread StartThread ( ThreadStart start , string name , ThreadPriority priority , bool isBackground , bool alarmIfTimeout , Func < string > alarmMethod , int timeout , bool log = true ) { Thread thread = new Thread ( start ) ; thread . Priority = priority ; thread . IsBackground = isBackground ; Watchdog . ThreadWatchdogInfo twi = new Watchdog . ThreadWatchdogInfo ( thread , timeout , name ) { AlarmIfTimeout = alarmIfTimeout , AlarmMethod = alarmMethod } ; Watchdog . AddThread ( twi , name , log : log ) ; thread . Start ( ) ; thread . Name = name ; return thread ; }
Start a new thread that is tracked by the watchdog
Start a new thread that is tracked by the watchdog
The newly created Thread object
The newly created Thread object
start
ThreadStart
The method that will be executed in a new thread
The method that will be executed in a new thread
name
string
A name to give to the new thread
A name to give to the new thread
priority
ThreadPriority
Priority to run the thread at
Priority to run the thread at
isBackground
bool
True to run this thread as a background
thread, otherwise false
True to run this thread as a background thread otherwise false
alarmIfTimeout
bool
Trigger an alarm function is we have timed out
Trigger an alarm function is we have timed out
alarmMethod
Func<string>
Alarm method to call if alarmIfTimeout is true and there is a timeout.
Normally, this will just return some useful debugging information.
Alarm method to call if alarmIfTimeout is true and there is a timeout . Normally this will just return some useful debugging information .
timeout
int
Number of milliseconds to wait until we issue a warning about timeout.
Number of milliseconds to wait until we issue a warning about timeout .
log
bool
If true then creation of thread is logged.
If true then creation of thread is logged .