You've already forked linux-packaging-mono
Imported Upstream version 5.16.0.100
Former-commit-id: 38faa55fb9669e35e7d8448b15c25dc447f25767
This commit is contained in:
parent
0a9828183b
commit
7d7f676260
@@ -3,7 +3,7 @@
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ref\System.Diagnostics.PerformanceCounter.csproj">
|
||||
<SupportedFramework>net461;netcoreapp2.0;$(AllXamarinFrameworks)</SupportedFramework>
|
||||
<SupportedFramework>uap10.0.16299;net461;netcoreapp2.0;$(AllXamarinFrameworks)</SupportedFramework>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\src\System.Diagnostics.PerformanceCounter.csproj" />
|
||||
</ItemGroup>
|
||||
|
@@ -165,6 +165,7 @@
|
||||
<Reference Include="System.Diagnostics.Tools" />
|
||||
<Reference Include="System.IO.FileSystem" />
|
||||
<Reference Include="System.IO.MemoryMappedFiles" />
|
||||
<Reference Include="System.Memory" />
|
||||
<Reference Include="System.Resources.ResourceManager" />
|
||||
<Reference Include="System.Runtime" />
|
||||
<Reference Include="System.Runtime.Extensions" />
|
||||
|
@@ -50,8 +50,9 @@ namespace System.Diagnostics
|
||||
private string _machineName;
|
||||
private string _perfLcid;
|
||||
|
||||
private Hashtable _customCategoryTable;
|
||||
|
||||
private static volatile Hashtable s_libraryTable;
|
||||
private Hashtable _customCategoryTable;
|
||||
private Hashtable _categoryTable;
|
||||
private Hashtable _nameTable;
|
||||
private Hashtable _helpTable;
|
||||
@@ -299,10 +300,17 @@ namespace System.Diagnostics
|
||||
{
|
||||
if (s_libraryTable != null)
|
||||
{
|
||||
foreach (PerformanceCounterLib library in s_libraryTable.Values)
|
||||
library.Close();
|
||||
//race with GetPerformanceCounterLib
|
||||
lock (InternalSyncObject)
|
||||
{
|
||||
if (s_libraryTable != null)
|
||||
{
|
||||
foreach (PerformanceCounterLib library in s_libraryTable.Values)
|
||||
library.Close();
|
||||
|
||||
s_libraryTable = null;
|
||||
s_libraryTable = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -638,14 +646,14 @@ namespace System.Diagnostics
|
||||
RegistryKey baseKey = null;
|
||||
categoryType = PerformanceCounterCategoryType.Unknown;
|
||||
|
||||
if (_customCategoryTable == null)
|
||||
{
|
||||
Interlocked.CompareExchange(ref _customCategoryTable, new Hashtable(StringComparer.OrdinalIgnoreCase), null);
|
||||
}
|
||||
Hashtable table =
|
||||
_customCategoryTable ??
|
||||
Interlocked.CompareExchange(ref _customCategoryTable, new Hashtable(StringComparer.OrdinalIgnoreCase), null) ??
|
||||
_customCategoryTable;
|
||||
|
||||
if (_customCategoryTable.ContainsKey(category))
|
||||
if (table.ContainsKey(category))
|
||||
{
|
||||
categoryType = (PerformanceCounterCategoryType)_customCategoryTable[category];
|
||||
categoryType = (PerformanceCounterCategoryType)table[category];
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -674,7 +682,10 @@ namespace System.Diagnostics
|
||||
// In this case we return an 'Unknown' category type and 'false' to indicate the category is *not* custom.
|
||||
//
|
||||
categoryType = PerformanceCounterCategoryType.Unknown;
|
||||
_customCategoryTable[category] = categoryType;
|
||||
lock (table)
|
||||
{
|
||||
table[category] = categoryType;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -702,8 +713,10 @@ namespace System.Diagnostics
|
||||
if (objectID != null)
|
||||
{
|
||||
int firstID = (int)objectID;
|
||||
|
||||
_customCategoryTable[category] = categoryType;
|
||||
lock (table)
|
||||
{
|
||||
table[category] = categoryType;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -717,6 +730,7 @@ namespace System.Diagnostics
|
||||
baseKey.Close();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -974,23 +988,21 @@ namespace System.Diagnostics
|
||||
|
||||
machineName = (machineName == "." ? ComputerName : machineName).ToLowerInvariant();
|
||||
|
||||
if (PerformanceCounterLib.s_libraryTable == null)
|
||||
//race with CloseAllLibraries
|
||||
lock (InternalSyncObject)
|
||||
{
|
||||
lock (InternalSyncObject)
|
||||
{
|
||||
if (PerformanceCounterLib.s_libraryTable == null)
|
||||
PerformanceCounterLib.s_libraryTable = new Hashtable();
|
||||
}
|
||||
}
|
||||
if (PerformanceCounterLib.s_libraryTable == null)
|
||||
PerformanceCounterLib.s_libraryTable = new Hashtable();
|
||||
|
||||
string libraryKey = machineName + ":" + lcidString;
|
||||
if (PerformanceCounterLib.s_libraryTable.Contains(libraryKey))
|
||||
return (PerformanceCounterLib)PerformanceCounterLib.s_libraryTable[libraryKey];
|
||||
else
|
||||
{
|
||||
PerformanceCounterLib library = new PerformanceCounterLib(machineName, lcidString);
|
||||
PerformanceCounterLib.s_libraryTable[libraryKey] = library;
|
||||
return library;
|
||||
string libraryKey = machineName + ":" + lcidString;
|
||||
if (PerformanceCounterLib.s_libraryTable.Contains(libraryKey))
|
||||
return (PerformanceCounterLib)PerformanceCounterLib.s_libraryTable[libraryKey];
|
||||
else
|
||||
{
|
||||
PerformanceCounterLib library = new PerformanceCounterLib(machineName, lcidString);
|
||||
PerformanceCounterLib.s_libraryTable[libraryKey] = library;
|
||||
return library;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,9 +1,6 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="PrivilegedConfigurationManager.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.Configuration {
|
||||
|
||||
|
Reference in New Issue
Block a user