Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal static partial class Sys
[LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_IsMemfdSupported", SetLastError = true)]
private static partial int MemfdSupportedImpl();

private static volatile NullableBool s_memfdSupported;
private static NullableBool s_memfdSupported;

internal static bool IsMemfdSupported
{
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/Common/src/System/Console/ConsoleUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace System
internal static partial class ConsoleUtils
{
/// <summary>Whether to output ansi color strings.</summary>
private static volatile NullableBool s_emitAnsiColorCodes;
private static NullableBool s_emitAnsiColorCodes;

/// <summary>Get whether to emit ANSI color codes.</summary>
public static bool EmitAnsiColorCodes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ public override void CopyFrom(AsnEncodedData asnEncodedData)
return new Oid(contentTypeValue);
}

private volatile Oid? _lazyContentType;
private Oid? _lazyContentType;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@ private static byte[] Encode(string documentDescription)
return PkcsHelpers.EncodeOctetString(octets);
}

private volatile string? _lazyDocumentDescription;
private string? _lazyDocumentDescription;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@ private static byte[] Encode(string documentName)
return PkcsHelpers.EncodeOctetString(octets);
}

private volatile string? _lazyDocumentName;
private string? _lazyDocumentName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ public override void CopyFrom(AsnEncodedData asnEncodedData)
return PkcsHelpers.DecodeOctetString(rawData);
}

private volatile byte[]? _lazyMessageDigest;
private byte[]? _lazyMessageDigest;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace System.ComponentModel.Composition.Hosting
public partial class ApplicationCatalog : ComposablePartCatalog, ICompositionElement
{
private bool _isDisposed;
private volatile AggregateCatalog? _innerCatalog;
private AggregateCatalog? _innerCatalog;
private readonly object _thisLock = new object();
private readonly ICompositionElement? _definitionOrigin;
private readonly ReflectionContext? _reflectionContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public class AssemblyCatalog : ComposablePartCatalog, ICompositionElement
{
private readonly object _thisLock = new object();
private readonly ICompositionElement _definitionOrigin;
private volatile Assembly _assembly;
private volatile ComposablePartCatalog? _innerCatalog;
private Assembly _assembly;
private ComposablePartCatalog? _innerCatalog;
private int _isDisposed;

private readonly ReflectionContext? _reflectionContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class TypeCatalog : ComposablePartCatalog, ICompositionElement
{
private readonly object _thisLock = new object();
private Type[]? _types;
private volatile List<ComposablePartDefinition>? _parts;
private List<ComposablePartDefinition>? _parts;
private volatile bool _isDisposed;
private readonly ICompositionElement _definitionOrigin;
private readonly Lazy<Dictionary<string, List<ComposablePartDefinition>>> _contractPartIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace System.ComponentModel.Composition.Primitives
public abstract class ComposablePartCatalog : IEnumerable<ComposablePartDefinition>, IDisposable
{
private bool _isDisposed;
private volatile IQueryable<ComposablePartDefinition>? _queryableParts;
private IQueryable<ComposablePartDefinition>? _queryableParts;

internal static readonly List<Tuple<ComposablePartDefinition, ExportDefinition>> _EmptyExportsList = new List<Tuple<ComposablePartDefinition, ExportDefinition>>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class Export
private readonly ExportDefinition? _definition;
private readonly Func<object?>? _exportedValueGetter;
private static readonly object _EmptyValue = new object();
private volatile object? _exportedValue = Export._EmptyValue;
private object? _exportedValue = Export._EmptyValue;

/// <summary>
/// Initializes a new instance of the <see cref="Export"/> class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ namespace System.ComponentModel.Composition.ReflectionModel
internal class ReflectionComposablePart : ComposablePart, ICompositionElement
{
private readonly ReflectionComposablePartDefinition _definition;
private volatile Dictionary<ImportDefinition, object?>? _importValues;
private volatile Dictionary<ImportDefinition, ImportingItem>? _importsCache;
private volatile Dictionary<int, ExportingMember>? _exportsCache;
private Dictionary<ImportDefinition, object?>? _importValues;
private Dictionary<ImportDefinition, ImportingItem>? _importsCache;
private Dictionary<int, ExportingMember>? _exportsCache;
private volatile bool _invokeImportsSatisfied = true;
private bool _initialCompositionComplete;
private volatile object? _cachedInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ internal sealed class ReflectionComposablePartDefinition : ComposablePartDefinit
{
private readonly IReflectionPartCreationInfo _creationInfo;

private volatile ImportDefinition[]? _imports;
private volatile ExportDefinition[]? _exports;
private volatile IDictionary<string, object?>? _metadata;
private volatile ConstructorInfo? _constructor;
private ImportDefinition[]? _imports;
private ExportDefinition[]? _exports;
private IDictionary<string, object?>? _metadata;
private ConstructorInfo? _constructor;
private readonly object _lock = new object();

public ReflectionComposablePartDefinition(IReflectionPartCreationInfo creationInfo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace System.ComponentModel
/// </summary>
public class BooleanConverter : TypeConverter
{
private static volatile StandardValuesCollection? s_values;
private static StandardValuesCollection? s_values;

/// <summary>
/// Gets a value indicating whether this converter can convert an object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ public sealed partial class LicenseManager
{
private static readonly object s_selfLock = new object();

private static volatile LicenseContext? s_context;
private static LicenseContext? s_context;
private static object? s_contextLockHolder;
private static volatile Hashtable? s_providers;
private static volatile Hashtable? s_providerInstances;
private static Hashtable? s_providers;
private static Hashtable? s_providerInstances;
private static readonly object s_internalSyncObject = new object();

// not creatable...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ internal sealed class ExportDescriptorRegistry
{
private readonly object _thisLock = new object();
private readonly ExportDescriptorProvider[] _exportDescriptorProviders;
private volatile Dictionary<CompositionContract, ExportDescriptor[]> _partDefinitions = new Dictionary<CompositionContract, ExportDescriptor[]>();
private Dictionary<CompositionContract, ExportDescriptor[]> _partDefinitions = new Dictionary<CompositionContract, ExportDescriptor[]>();

public ExportDescriptorRegistry(ExportDescriptorProvider[] exportDescriptorProviders)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ namespace System.Configuration
{
public sealed class AppSettingsSection : ConfigurationSection
{
private static volatile ConfigurationPropertyCollection s_properties;
private static volatile ConfigurationProperty s_propAppSettings;
private static volatile ConfigurationProperty s_propFile;
private static ConfigurationPropertyCollection s_properties;
private static ConfigurationProperty s_propAppSettings;
private static ConfigurationProperty s_propFile;

private KeyValueInternalCollection _keyValueCollection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal sealed class ClientConfigPaths
private const string UrlDesc = "Url";
private const string PathDesc = "Path";

private static volatile ClientConfigPaths s_current;
private static ClientConfigPaths s_current;
private static volatile bool s_currentIncludesUserConfig;

private readonly bool _includesUserConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal sealed class ClientConfigurationHost : DelegatingConfigHost, IInternalC
private const string MachineConfigSubdirectory = "Config";

private static readonly object s_version = new object();
private static volatile string s_machineConfigFilePath;
private static string s_machineConfigFilePath;
private ClientConfigPaths _configPaths; // physical paths to client config files

private string _exePath; // the physical path to the exe being configured
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private sealed class ClientSettingsConfigurationHost : DelegatingConfigHost
{
private const string ClientConfigurationHostTypeName = "System.Configuration.ClientConfigurationHost, " + TypeUtil.ConfigurationManagerAssemblyName;
private const string InternalConfigConfigurationFactoryTypeName = "System.Configuration.Internal.InternalConfigConfigurationFactory, " + TypeUtil.ConfigurationManagerAssemblyName;
private static volatile IInternalConfigConfigurationFactory s_configFactory;
private static IInternalConfigConfigurationFactory s_configFactory;

/// <summary>
/// ClientConfigurationHost implements this - a way of getting some info from it without
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public abstract class ConfigurationElement
};

private static readonly Hashtable s_propertyBags = new Hashtable();
private static volatile Dictionary<Type, ConfigurationValidatorBase> s_perTypeValidators;
private static Dictionary<Type, ConfigurationValidatorBase> s_perTypeValidators;
internal static readonly object s_nullPropertyValue = new object();

private static readonly ConfigurationElementProperty s_elementProperty =
Expand All @@ -52,7 +52,7 @@ public abstract class ConfigurationElement
internal BaseConfigurationRecord _configRecord;
private ConfigurationElementProperty _elementProperty = s_elementProperty;
internal ContextInformation _evalContext;
private volatile ElementInformation _evaluationElement;
private ElementInformation _evaluationElement;
internal ConfigurationValueFlags _itemLockedFlag;
internal ConfigurationLockCollection _lockedAllExceptAttributesList;
internal ConfigurationLockCollection _lockedAllExceptElementsList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace System.Configuration
{
internal static class ConfigurationManagerInternalFactory
{
private static volatile IConfigurationManagerInternal s_instance;
private static IConfigurationManagerInternal s_instance;

internal static IConfigurationManagerInternal Instance => s_instance ??= new ConfigurationManagerInternal();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace System.Configuration
{
internal sealed class ConfigurationValues : NameObjectCollectionBase
{
private static volatile IEnumerable s_emptyCollection;
private static IEnumerable s_emptyCollection;
private BaseConfigurationRecord _configRecord;
private volatile bool _containsElement;
private volatile bool _containsInvalidValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace System.Configuration
{
public sealed class DefaultSection : ConfigurationSection
{
private static volatile ConfigurationPropertyCollection s_properties;
private static ConfigurationPropertyCollection s_properties;
private bool _isModified;

private string _rawXml = string.Empty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace System.Configuration
// Used in cases where the Host does not require impersonation.
internal sealed class EmptyImpersonationContext : IDisposable
{
private static volatile IDisposable s_emptyImpersonationContext;
private static IDisposable s_emptyImpersonationContext;

public void Dispose() { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace System.Configuration
{
public sealed class IgnoreSection : ConfigurationSection
{
private static volatile ConfigurationPropertyCollection s_properties;
private static ConfigurationPropertyCollection s_properties;
private bool _isModified;

private string _rawXml = string.Empty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace System.Configuration
{
public sealed class SettingValueElement : ConfigurationElement
{
private static volatile ConfigurationPropertyCollection _properties;
private static ConfigurationPropertyCollection _properties;
private static readonly XmlDocument _document = new XmlDocument();

private XmlNode _valueXml;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace System.Diagnostics
{
internal static class DiagnosticsConfiguration
{
private static volatile SystemDiagnosticsSection s_configSection;
private static SystemDiagnosticsSection s_configSection;
private static volatile InitState s_initState = InitState.NotInitialized;

// Setting for Switch.switchSetting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ public EnumeratePropertyFetch(Type type) : base(type) { }

private readonly DiagnosticSourceEventSource _eventSource;
private readonly string _propertyName;
private volatile PropertyFetch? _fetchForExpectedType;
private PropertyFetch? _fetchForExpectedType;
#endregion
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ internal struct AggregatorStore<TAggregator> where TAggregator : Aggregator
// FixedSizeLabelNameDictionary<StringSequence3, ConcurrentDictionary<ObjectSequence3, TAggregator>>
// FixedSizeLabelNameDictionary<StringSequenceMany, ConcurrentDictionary<ObjectSequenceMany, TAggregator>>
// MultiSizeLabelNameDictionary<TAggregator> - this is used when we need to store more than one of the above union items
private volatile object? _stateUnion;
private volatile AggregatorLookupFunc<TAggregator>? _cachedLookupFunc;
private object? _stateUnion;
private AggregatorLookupFunc<TAggregator>? _cachedLookupFunc;
private readonly Func<TAggregator?> _createAggregatorFunc;

public AggregatorStore(Func<TAggregator?> createAggregator)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ internal sealed class PerformanceCounterLib
private const string LanguageKeyword = "language";
private const string DllName = "netfxperf.dll";

private static volatile string s_computerName;
private static volatile string s_iniFilePath;
private static volatile string s_symbolFilePath;
private static string s_computerName;
private static string s_iniFilePath;
private static string s_symbolFilePath;

private static CultureInfo? s_englishCulture;

Expand All @@ -55,7 +55,7 @@ internal sealed class PerformanceCounterLib
private readonly string _perfLcid;


private static volatile Hashtable s_libraryTable;
private static Hashtable s_libraryTable;
private Hashtable _customCategoryTable;
private Hashtable _categoryTable;
private Hashtable _nameTable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal sealed unsafe class SharedPerformanceCounter

private static long s_lastInstanceLifetimeSweepTick;
private const long InstanceLifetimeSweepWindow = 30 * 10000000; //ticks
private static volatile ProcessData s_procData;
private static ProcessData s_procData;

private static ProcessData ProcessData
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace System.Diagnostics
{
internal static partial class ProcessManager
{
private static volatile NullableBool _procMatchesPidNamespace;
private static NullableBool _procMatchesPidNamespace;

/// <summary>Gets the IDs of all processes on the current machine.</summary>
public static int[] GetProcessIds() => new List<int>(EnumerateProcessIds()).ToArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public abstract partial class Expression
internal const string DelegateCreationRequiresDynamicCode = "Delegate creation requires dynamic code generation.";

private static readonly CacheDict<Type, MethodInfo> s_lambdaDelegateCache = new CacheDict<Type, MethodInfo>(40);
private static volatile CacheDict<Type, Func<Expression, string?, bool, ReadOnlyCollection<ParameterExpression>, LambdaExpression>>? s_lambdaFactories;
private static CacheDict<Type, Func<Expression, string?, bool, ReadOnlyCollection<ParameterExpression>, LambdaExpression>>? s_lambdaFactories;

// For 4.0, many frequently used Expression nodes have had their memory
// footprint reduced by removing the Type and NodeType fields. This has
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class CallSite
/// <summary>
/// Cache of CallSite constructors for a given delegate type.
/// </summary>
private static volatile CacheDict<Type, Func<CallSiteBinder, CallSite>>? s_siteCtors;
private static CacheDict<Type, Func<CallSiteBinder, CallSite>>? s_siteCtors;

/// <summary>
/// The Binder responsible for binding operations at this call site.
Expand Down Expand Up @@ -162,7 +162,7 @@ public T Update
private static T? s_cachedUpdate;

// Cached noMatch delegate for all sites with a given T
private static volatile T? s_cachedNoMatch;
private static T? s_cachedNoMatch;

[RequiresDynamicCode(Expression.NewArrayRequiresDynamicCode)]
private CallSite(CallSiteBinder binder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ private EmptyEnumerable()
}

// A singleton cached and shared among callers.
private static volatile EmptyEnumerable<T>? s_instance;
private static volatile EmptyEnumerator<T>? s_enumeratorInstance;
private static EmptyEnumerable<T>? s_instance;
private static EmptyEnumerator<T>? s_enumeratorInstance;

internal static EmptyEnumerable<T> Instance =>
// There is no need for thread safety here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal static partial class AuthenticationHelper
private const string UsePortInSpnCtxSwitch = "System.Net.Http.UsePortInSpn";
private const string UsePortInSpnEnvironmentVariable = "DOTNET_SYSTEM_NET_HTTP_USEPORTINSPN";

private static volatile NullableBool s_usePortInSpn;
private static NullableBool s_usePortInSpn;

private static bool UsePortInSpn
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace System.Net
{
internal static partial class NameResolutionPal
{
private static volatile NullableBool s_getAddrInfoExSupported;
private static NullableBool s_getAddrInfoExSupported;

public static bool SupportsGetAddrInfoAsync
{
Expand Down
Loading
Loading