diff options
Diffstat (limited to 'OpenSim/Framework/Monitoring/Watchdog.cs')
-rw-r--r-- | OpenSim/Framework/Monitoring/Watchdog.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index 0fcb195..b00aa5c 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs | |||
@@ -133,6 +133,8 @@ namespace OpenSim.Framework.Monitoring | |||
133 | /// /summary> | 133 | /// /summary> |
134 | public static event Action<ThreadWatchdogInfo> OnWatchdogTimeout; | 134 | public static event Action<ThreadWatchdogInfo> OnWatchdogTimeout; |
135 | 135 | ||
136 | private static JobEngine m_jobEngine; | ||
137 | |||
136 | /// <summary> | 138 | /// <summary> |
137 | /// Is this watchdog active? | 139 | /// Is this watchdog active? |
138 | /// </summary> | 140 | /// </summary> |
@@ -173,6 +175,7 @@ namespace OpenSim.Framework.Monitoring | |||
173 | 175 | ||
174 | static Watchdog() | 176 | static Watchdog() |
175 | { | 177 | { |
178 | m_jobEngine = new JobEngine(); | ||
176 | m_threads = new Dictionary<int, ThreadWatchdogInfo>(); | 179 | m_threads = new Dictionary<int, ThreadWatchdogInfo>(); |
177 | m_watchdogTimer = new System.Timers.Timer(WATCHDOG_INTERVAL_MS); | 180 | m_watchdogTimer = new System.Timers.Timer(WATCHDOG_INTERVAL_MS); |
178 | m_watchdogTimer.AutoReset = false; | 181 | m_watchdogTimer.AutoReset = false; |
@@ -450,5 +453,20 @@ namespace OpenSim.Framework.Monitoring | |||
450 | 453 | ||
451 | m_watchdogTimer.Start(); | 454 | m_watchdogTimer.Start(); |
452 | } | 455 | } |
456 | |||
457 | public static void RunWhenPossible(string jobType, WaitCallback callback, string name, object obj, bool log = false) | ||
458 | { | ||
459 | if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest) | ||
460 | { | ||
461 | Culture.SetCurrentCulture(); | ||
462 | callback(obj); | ||
463 | return; | ||
464 | } | ||
465 | |||
466 | if (m_jobEngine.IsRunning) | ||
467 | m_jobEngine.QueueRequest(name, callback, obj); | ||
468 | else | ||
469 | RunInThread(callback, name, obj, log); | ||
470 | } | ||
453 | } | 471 | } |
454 | } \ No newline at end of file | 472 | } \ No newline at end of file |