diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Monitoring/WorkManager.cs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/OpenSim/Framework/Monitoring/WorkManager.cs b/OpenSim/Framework/Monitoring/WorkManager.cs index a7a03a0..43130f9 100644 --- a/OpenSim/Framework/Monitoring/WorkManager.cs +++ b/OpenSim/Framework/Monitoring/WorkManager.cs | |||
@@ -36,16 +36,16 @@ namespace OpenSim.Framework.Monitoring | |||
36 | /// Manages various work items in the simulator. | 36 | /// Manages various work items in the simulator. |
37 | /// </summary> | 37 | /// </summary> |
38 | /// <remarks> | 38 | /// <remarks> |
39 | /// Currently, here work can be started | 39 | /// Currently, here work can be started |
40 | /// * As a long-running and monitored thread. | 40 | /// * As a long-running and monitored thread. |
41 | /// * In a thread that will never timeout but where the job is expected to eventually complete. | 41 | /// * In a thread that will never timeout but where the job is expected to eventually complete. |
42 | /// * In a threadpool thread that will timeout if it takes a very long time to complete (> 10 mins). | 42 | /// * In a threadpool thread that will timeout if it takes a very long time to complete (> 10 mins). |
43 | /// * As a job which will be run in a single-threaded job engine. Such jobs must not incorporate delays (sleeps, | 43 | /// * As a job which will be run in a single-threaded job engine. Such jobs must not incorporate delays (sleeps, |
44 | /// network waits, etc.). | 44 | /// network waits, etc.). |
45 | /// | 45 | /// |
46 | /// This is an evolving approach to better manage the work that OpenSimulator is asked to do from a very diverse | 46 | /// This is an evolving approach to better manage the work that OpenSimulator is asked to do from a very diverse |
47 | /// range of sources (client actions, incoming network, outgoing network calls, etc.). | 47 | /// range of sources (client actions, incoming network, outgoing network calls, etc.). |
48 | /// | 48 | /// |
49 | /// Util.FireAndForget is still available to insert jobs in the threadpool, though this is equivalent to | 49 | /// Util.FireAndForget is still available to insert jobs in the threadpool, though this is equivalent to |
50 | /// WorkManager.RunInThreadPool(). | 50 | /// WorkManager.RunInThreadPool(). |
51 | /// </remarks> | 51 | /// </remarks> |
@@ -122,7 +122,7 @@ namespace OpenSim.Framework.Monitoring | |||
122 | thread.Priority = priority; | 122 | thread.Priority = priority; |
123 | thread.IsBackground = isBackground; | 123 | thread.IsBackground = isBackground; |
124 | thread.Name = name; | 124 | thread.Name = name; |
125 | 125 | ||
126 | Watchdog.ThreadWatchdogInfo twi | 126 | Watchdog.ThreadWatchdogInfo twi |
127 | = new Watchdog.ThreadWatchdogInfo(thread, timeout, name) | 127 | = new Watchdog.ThreadWatchdogInfo(thread, timeout, name) |
128 | { AlarmIfTimeout = alarmIfTimeout, AlarmMethod = alarmMethod }; | 128 | { AlarmIfTimeout = alarmIfTimeout, AlarmMethod = alarmMethod }; |
@@ -144,7 +144,7 @@ namespace OpenSim.Framework.Monitoring | |||
144 | /// <param name="name">Name of the thread</param> | 144 | /// <param name="name">Name of the thread</param> |
145 | public static void RunInThread(WaitCallback callback, object obj, string name, bool log = false) | 145 | public static void RunInThread(WaitCallback callback, object obj, string name, bool log = false) |
146 | { | 146 | { |
147 | if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest) | 147 | if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest) |
148 | { | 148 | { |
149 | Culture.SetCurrentCulture(); | 149 | Culture.SetCurrentCulture(); |
150 | callback(obj); | 150 | callback(obj); |
@@ -169,7 +169,7 @@ namespace OpenSim.Framework.Monitoring | |||
169 | } | 169 | } |
170 | 170 | ||
171 | /// <summary> | 171 | /// <summary> |
172 | /// Run the callback via a threadpool thread. | 172 | /// Run the callback via a threadpool thread. |
173 | /// </summary> | 173 | /// </summary> |
174 | /// <remarks> | 174 | /// <remarks> |
175 | /// Such jobs may run after some delay but must always complete. | 175 | /// Such jobs may run after some delay but must always complete. |
@@ -188,17 +188,17 @@ namespace OpenSim.Framework.Monitoring | |||
188 | /// <remarks> | 188 | /// <remarks> |
189 | /// This differs from direct scheduling (e.g. Util.FireAndForget) in that a job can be run in the job | 189 | /// This differs from direct scheduling (e.g. Util.FireAndForget) in that a job can be run in the job |
190 | /// engine if it is running, where all jobs are currently performed in sequence on a single thread. This is | 190 | /// engine if it is running, where all jobs are currently performed in sequence on a single thread. This is |
191 | /// to prevent observed overload and server freeze problems when there are hundreds of connections which all attempt to | 191 | /// to prevent observed overload and server freeze problems when there are hundreds of connections which all attempt to |
192 | /// perform work at once (e.g. in conference situations). With lower numbers of connections, the small | 192 | /// perform work at once (e.g. in conference situations). With lower numbers of connections, the small |
193 | /// delay in performing jobs in sequence rather than concurrently has not been notiecable in testing, though a future more | 193 | /// delay in performing jobs in sequence rather than concurrently has not been notiecable in testing, though a future more |
194 | /// sophisticated implementation could perform jobs concurrently when the server is under low load. | 194 | /// sophisticated implementation could perform jobs concurrently when the server is under low load. |
195 | /// | 195 | /// |
196 | /// However, be advised that some callers of this function rely on all jobs being performed in sequence if any | 196 | /// However, be advised that some callers of this function rely on all jobs being performed in sequence if any |
197 | /// jobs are performed in sequence (i.e. if jobengine is active or not). Therefore, expanding the jobengine | 197 | /// jobs are performed in sequence (i.e. if jobengine is active or not). Therefore, expanding the jobengine |
198 | /// beyond a single thread will require considerable thought. | 198 | /// beyond a single thread will require considerable thought. |
199 | /// | 199 | /// |
200 | /// Also, any jobs submitted must be guaranteed to complete within a reasonable timeframe (e.g. they cannot | 200 | /// Also, any jobs submitted must be guaranteed to complete within a reasonable timeframe (e.g. they cannot |
201 | /// incorporate a network delay with a long timeout). At the moment, work that could suffer such issues | 201 | /// incorporate a network delay with a long timeout). At the moment, work that could suffer such issues |
202 | /// should still be run directly with RunInThread(), Util.FireAndForget(), etc. This is another area where | 202 | /// should still be run directly with RunInThread(), Util.FireAndForget(), etc. This is another area where |
203 | /// the job engine could be improved and so CPU utilization improved by better management of concurrency within | 203 | /// the job engine could be improved and so CPU utilization improved by better management of concurrency within |
204 | /// OpenSimulator. | 204 | /// OpenSimulator. |
@@ -212,10 +212,10 @@ namespace OpenSim.Framework.Monitoring | |||
212 | /// <param name="log">If set to true then extra logging is performed.</param> | 212 | /// <param name="log">If set to true then extra logging is performed.</param> |
213 | public static void RunJob( | 213 | public static void RunJob( |
214 | string jobType, WaitCallback callback, object obj, string name, | 214 | string jobType, WaitCallback callback, object obj, string name, |
215 | bool canRunInThisThread = false, bool mustNotTimeout = false, | 215 | bool canRunInThisThread = false, bool mustNotTimeout = false, |
216 | bool log = false) | 216 | bool log = false) |
217 | { | 217 | { |
218 | if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest) | 218 | if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest) |
219 | { | 219 | { |
220 | Culture.SetCurrentCulture(); | 220 | Culture.SetCurrentCulture(); |
221 | callback(obj); | 221 | callback(obj); |
@@ -273,16 +273,16 @@ namespace OpenSim.Framework.Monitoring | |||
273 | MainConsole.Instance.Output("Usage: debug jobengine log <level>"); | 273 | MainConsole.Instance.Output("Usage: debug jobengine log <level>"); |
274 | return; | 274 | return; |
275 | } | 275 | } |
276 | 276 | ||
277 | // int logLevel; | 277 | // int logLevel; |
278 | int logLevel = int.Parse(args[3]); | 278 | int logLevel = int.Parse(args[3]); |
279 | // if (ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[4], out logLevel)) | 279 | // if (ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[4], out logLevel)) |
280 | // { | 280 | // { |
281 | JobEngine.LogLevel = logLevel; | 281 | JobEngine.LogLevel = logLevel; |
282 | MainConsole.Instance.OutputFormat("Set debug log level to {0}", JobEngine.LogLevel); | 282 | MainConsole.Instance.OutputFormat("Set debug log level to {0}", JobEngine.LogLevel); |
283 | // } | 283 | // } |
284 | } | 284 | } |
285 | else | 285 | else |
286 | { | 286 | { |
287 | MainConsole.Instance.OutputFormat("Unrecognized job engine subcommand {0}", subCommand); | 287 | MainConsole.Instance.OutputFormat("Unrecognized job engine subcommand {0}", subCommand); |
288 | } | 288 | } |