diff options
author | Oren Hurvitz | 2013-11-27 14:15:21 +0200 |
---|---|---|
committer | Oren Hurvitz | 2014-03-25 08:01:37 +0100 |
commit | 4031933475a8df81629862bfcdc497ac57d01223 (patch) | |
tree | 01fddd6cc3796ce0b8ae7df93bb4136e9e178fc6 | |
parent | Automatically start logging FireAndForget activity if the threadpool is full (diff) | |
download | opensim-SC_OLD-4031933475a8df81629862bfcdc497ac57d01223.zip opensim-SC_OLD-4031933475a8df81629862bfcdc497ac57d01223.tar.gz opensim-SC_OLD-4031933475a8df81629862bfcdc497ac57d01223.tar.bz2 opensim-SC_OLD-4031933475a8df81629862bfcdc497ac57d01223.tar.xz |
Refactored DebugFlagsEnum
Resolves http://opensimulator.org/mantis/view.php?id=6945
-rw-r--r-- | OpenSim/Framework/Util.cs | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 0dfee71..225d360 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Framework | |||
67 | // All does not contain Export, which is special and must be | 67 | // All does not contain Export, which is special and must be |
68 | // explicitly given | 68 | // explicitly given |
69 | All = (1 << 13) | (1 << 14) | (1 << 15) | (1 << 19) | 69 | All = (1 << 13) | (1 << 14) | (1 << 15) | (1 << 19) |
70 | } | 70 | } |
71 | 71 | ||
72 | /// <summary> | 72 | /// <summary> |
73 | /// The method used by Util.FireAndForget for asynchronously firing events | 73 | /// The method used by Util.FireAndForget for asynchronously firing events |
@@ -109,6 +109,15 @@ namespace OpenSim.Framework | |||
109 | public int MaxConcurrentWorkItems { get; set; } | 109 | public int MaxConcurrentWorkItems { get; set; } |
110 | } | 110 | } |
111 | 111 | ||
112 | [Flags] | ||
113 | public enum DebugFlagsEnum : uint | ||
114 | { | ||
115 | None = 0, | ||
116 | |||
117 | // Log every invocation of a thread using the threadpool | ||
118 | LogThreadPool = 0x01 | ||
119 | } | ||
120 | |||
112 | /// <summary> | 121 | /// <summary> |
113 | /// Miscellaneous utility functions | 122 | /// Miscellaneous utility functions |
114 | /// </summary> | 123 | /// </summary> |
@@ -117,13 +126,13 @@ namespace OpenSim.Framework | |||
117 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 126 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
118 | 127 | ||
119 | /// <summary> | 128 | /// <summary> |
120 | /// Log every invocation of a thread using the threadpool. | 129 | /// Flags that enable additional debugging. |
121 | /// </summary> | 130 | /// </summary> |
122 | public static bool LogThreadPool { get; set; } | 131 | public static DebugFlagsEnum DebugFlags { get; set; } |
123 | 132 | ||
124 | static Util() | 133 | static Util() |
125 | { | 134 | { |
126 | LogThreadPool = false; | 135 | DebugFlags = DebugFlagsEnum.None; |
127 | } | 136 | } |
128 | 137 | ||
129 | private static uint nextXferID = 5000; | 138 | private static uint nextXferID = 5000; |
@@ -1907,7 +1916,7 @@ namespace OpenSim.Framework | |||
1907 | { | 1916 | { |
1908 | WaitCallback realCallback; | 1917 | WaitCallback realCallback; |
1909 | 1918 | ||
1910 | bool loggingEnabled = LogThreadPool; | 1919 | bool loggingEnabled = (DebugFlags & DebugFlagsEnum.LogThreadPool) != 0; |
1911 | 1920 | ||
1912 | long threadFuncNum = Interlocked.Increment(ref nextThreadFuncNum); | 1921 | long threadFuncNum = Interlocked.Increment(ref nextThreadFuncNum); |
1913 | 1922 | ||