+2005-01-13 Jonathan Pryor <jonpryor@vt.edu>
+
+ * DiagnosticsConfigurationHandler.cs: Make DiagnosticsConfiguration.Settings
+ thread-safe (double-checked locking isn't thread safe on .NET without
+ using a volatile variable, and setting the variable in the static
+ constructor is easier anyway).
+ * Switch.cs (GetConfigFileSetting): If the setting is non-numeric, set the
+ attribute value to the string "0". This is apparently what .NET 1.1 does,
+ and allows the SwitchTest NUnit test to work w/o failures.
+
2004-12-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* Process.cs: always pass the same arguments to the runtime.
// John R. Hicks <angryjohn69@nc.rr.com>
// Jonathan Pryor <jonpryor@vt.edu>
//
-// (C) 2002
+// (C) 2002, 2005
//
//
{
internal sealed class DiagnosticsConfiguration
{
- private static IDictionary settings = null;
+ private static IDictionary settings =
+ (IDictionary) ConfigurationSettings.GetConfig ("system.diagnostics");
public static IDictionary Settings {
get {
- // TODO: Does anybody know if this is actually thread-safe under .NET?
- // I've heard that this construct isn't safe under Java, but it's used
- // reasonably often under C++, so I'm not sure about .NET.
- if (settings == null) {
- lock (typeof(DiagnosticsConfiguration)) {
- if (settings == null)
- settings = (IDictionary) ConfigurationSettings.GetConfig ("system.diagnostics");
- }
- }
return settings;
}
}
private void GetConfigFileSetting ()
{
+ IDictionary d = (IDictionary) DiagnosticsConfiguration.Settings ["switches"];
try {
// Load up the specified switch
- IDictionary d = (IDictionary) DiagnosticsConfiguration.Settings ["switches"];
if (d != null)
switchSetting = int.Parse (d [name].ToString());
} catch {
switchSetting = 0;
+ if (d != null)
+ d [name] = "0";
}
}