aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Util.cs21
1 files changed, 21 insertions, 0 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 10f38ab..87ba5a8 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1330,6 +1330,27 @@ namespace OpenSim.Framework
1330 m_ThreadPool = new SmartThreadPool(2000, maxThreads, 2); 1330 m_ThreadPool = new SmartThreadPool(2000, maxThreads, 2);
1331 } 1331 }
1332 1332
1333 public static int FireAndForgetCount()
1334 {
1335 const int MAX_SYSTEM_THREADS = 200;
1336
1337 switch (FireAndForgetMethod)
1338 {
1339 case FireAndForgetMethod.UnsafeQueueUserWorkItem:
1340 case FireAndForgetMethod.QueueUserWorkItem:
1341 case FireAndForgetMethod.BeginInvoke:
1342 int workerThreads, iocpThreads;
1343 ThreadPool.GetAvailableThreads(out workerThreads, out iocpThreads);
1344 return workerThreads;
1345 case FireAndForgetMethod.SmartThreadPool:
1346 return m_ThreadPool.MaxThreads - m_ThreadPool.InUseThreads;
1347 case FireAndForgetMethod.Thread:
1348 return MAX_SYSTEM_THREADS - System.Diagnostics.Process.GetCurrentProcess().Threads.Count;
1349 default:
1350 throw new NotImplementedException();
1351 }
1352 }
1353
1333 public static void FireAndForget(System.Threading.WaitCallback callback, object obj) 1354 public static void FireAndForget(System.Threading.WaitCallback callback, object obj)
1334 { 1355 {
1335 switch (FireAndForgetMethod) 1356 switch (FireAndForgetMethod)