aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r--OpenSim/Framework/Util.cs28
1 files changed, 27 insertions, 1 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index baad0b9..97c958a 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -2052,6 +2052,9 @@ namespace OpenSim.Framework
2052 private static long numTotalThreadFuncsCalled = 0; 2052 private static long numTotalThreadFuncsCalled = 0;
2053 private static Int32 threadFuncOverloadMode = 0; 2053 private static Int32 threadFuncOverloadMode = 0;
2054 2054
2055 public static long TotalQueuedFireAndForgetCalls { get { return numQueuedThreadFuncs; } }
2056 public static long TotalRunningFireAndForgetCalls { get { return numRunningThreadFuncs; } }
2057
2055 // Maps (ThreadFunc number -> Thread) 2058 // Maps (ThreadFunc number -> Thread)
2056 private static ConcurrentDictionary<long, ThreadInfo> activeThreads = new ConcurrentDictionary<long, ThreadInfo>(); 2059 private static ConcurrentDictionary<long, ThreadInfo> activeThreads = new ConcurrentDictionary<long, ThreadInfo>();
2057 2060
@@ -2089,6 +2092,13 @@ namespace OpenSim.Framework
2089 2092
2090 private static Dictionary<string, int> m_fireAndForgetCallsMade = new Dictionary<string, int>(); 2093 private static Dictionary<string, int> m_fireAndForgetCallsMade = new Dictionary<string, int>();
2091 2094
2095 public static Dictionary<string, int> GetFireAndForgetCallsInProgress()
2096 {
2097 return new Dictionary<string, int>(m_fireAndForgetCallsInProgress);
2098 }
2099
2100 private static Dictionary<string, int> m_fireAndForgetCallsInProgress = new Dictionary<string, int>();
2101
2092 public static void FireAndForget(System.Threading.WaitCallback callback) 2102 public static void FireAndForget(System.Threading.WaitCallback callback)
2093 { 2103 {
2094 FireAndForget(callback, null, null); 2104 FireAndForget(callback, null, null);
@@ -2109,6 +2119,11 @@ namespace OpenSim.Framework
2109 m_fireAndForgetCallsMade[context] = 1; 2119 m_fireAndForgetCallsMade[context] = 1;
2110 else 2120 else
2111 m_fireAndForgetCallsMade[context]++; 2121 m_fireAndForgetCallsMade[context]++;
2122
2123 if (!m_fireAndForgetCallsInProgress.ContainsKey(context))
2124 m_fireAndForgetCallsInProgress[context] = 1;
2125 else
2126 m_fireAndForgetCallsInProgress[context]++;
2112 } 2127 }
2113 2128
2114 WaitCallback realCallback; 2129 WaitCallback realCallback;
@@ -2121,7 +2136,15 @@ namespace OpenSim.Framework
2121 if (FireAndForgetMethod == FireAndForgetMethod.RegressionTest) 2136 if (FireAndForgetMethod == FireAndForgetMethod.RegressionTest)
2122 { 2137 {
2123 // If we're running regression tests, then we want any exceptions to rise up to the test code. 2138 // If we're running regression tests, then we want any exceptions to rise up to the test code.
2124 realCallback = o => { Culture.SetCurrentCulture(); callback(o); }; 2139 realCallback =
2140 o =>
2141 {
2142 Culture.SetCurrentCulture();
2143 callback(o);
2144
2145 if (context != null)
2146 m_fireAndForgetCallsInProgress[context]--;
2147 };
2125 } 2148 }
2126 else 2149 else
2127 { 2150 {
@@ -2160,6 +2183,9 @@ namespace OpenSim.Framework
2160 activeThreads.TryRemove(threadFuncNum, out dummy); 2183 activeThreads.TryRemove(threadFuncNum, out dummy);
2161 if ((loggingEnabled || (threadFuncOverloadMode == 1)) && threadInfo.LogThread) 2184 if ((loggingEnabled || (threadFuncOverloadMode == 1)) && threadInfo.LogThread)
2162 m_log.DebugFormat("Exit threadfunc {0} ({1})", threadFuncNum, FormatDuration(threadInfo.Elapsed())); 2185 m_log.DebugFormat("Exit threadfunc {0} ({1})", threadFuncNum, FormatDuration(threadInfo.Elapsed()));
2186
2187 if (context != null)
2188 m_fireAndForgetCallsInProgress[context]--;
2163 } 2189 }
2164 }; 2190 };
2165 } 2191 }