Refactored DebugFlagsEnum

Resolves http://opensimulator.org/mantis/view.php?id=6945
0.8.0.3
Oren Hurvitz 2013-11-27 14:15:21 +02:00
parent 8555e54e22
commit 4031933475
1 changed files with 14 additions and 5 deletions

View File

@ -67,7 +67,7 @@ namespace OpenSim.Framework
// All does not contain Export, which is special and must be // All does not contain Export, which is special and must be
// explicitly given // explicitly given
All = (1 << 13) | (1 << 14) | (1 << 15) | (1 << 19) All = (1 << 13) | (1 << 14) | (1 << 15) | (1 << 19)
} }
/// <summary> /// <summary>
/// The method used by Util.FireAndForget for asynchronously firing events /// The method used by Util.FireAndForget for asynchronously firing events
@ -109,6 +109,15 @@ namespace OpenSim.Framework
public int MaxConcurrentWorkItems { get; set; } public int MaxConcurrentWorkItems { get; set; }
} }
[Flags]
public enum DebugFlagsEnum : uint
{
None = 0,
// Log every invocation of a thread using the threadpool
LogThreadPool = 0x01
}
/// <summary> /// <summary>
/// Miscellaneous utility functions /// Miscellaneous utility functions
/// </summary> /// </summary>
@ -117,13 +126,13 @@ namespace OpenSim.Framework
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// Log every invocation of a thread using the threadpool. /// Flags that enable additional debugging.
/// </summary> /// </summary>
public static bool LogThreadPool { get; set; } public static DebugFlagsEnum DebugFlags { get; set; }
static Util() static Util()
{ {
LogThreadPool = false; DebugFlags = DebugFlagsEnum.None;
} }
private static uint nextXferID = 5000; private static uint nextXferID = 5000;
@ -1907,7 +1916,7 @@ namespace OpenSim.Framework
{ {
WaitCallback realCallback; WaitCallback realCallback;
bool loggingEnabled = LogThreadPool; bool loggingEnabled = (DebugFlags & DebugFlagsEnum.LogThreadPool) != 0;
long threadFuncNum = Interlocked.Increment(ref nextThreadFuncNum); long threadFuncNum = Interlocked.Increment(ref nextThreadFuncNum);