You've already forked linux-packaging-mono
Imported Upstream version 5.2.0.175
Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
parent
4bdbaf4a88
commit
966bba02bb
50
external/corefx/src/System.Threading.Thread/System.Threading.Thread.sln
vendored
Normal file
50
external/corefx/src/System.Threading.Thread/System.Threading.Thread.sln
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Threading.Thread.Tests", "tests\System.Threading.Thread.Tests.csproj", "{33F5A50E-B823-4FDD-8571-365C909ACEAE}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{06197EED-FF48-43F3-976D-463839D43E8C} = {06197EED-FF48-43F3-976D-463839D43E8C}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Threading.Thread", "src\System.Threading.Thread.csproj", "{06197EED-FF48-43F3-976D-463839D43E8C}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{82D06A2D-008D-4A4A-A83D-FB7F04721C87} = {82D06A2D-008D-4A4A-A83D-FB7F04721C87}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Threading.Thread", "ref\System.Threading.Thread.csproj", "{82D06A2D-008D-4A4A-A83D-FB7F04721C87}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1A2F9F4A-A032-433E-B914-ADD5992BB178}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E107E9C1-E893-4E87-987E-04EF0DCEAEFD}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{2E666815-2EDB-464B-9DF6-380BF4789AD4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{33F5A50E-B823-4FDD-8571-365C909ACEAE}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU
|
||||
{33F5A50E-B823-4FDD-8571-365C909ACEAE}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU
|
||||
{33F5A50E-B823-4FDD-8571-365C909ACEAE}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU
|
||||
{33F5A50E-B823-4FDD-8571-365C909ACEAE}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU
|
||||
{06197EED-FF48-43F3-976D-463839D43E8C}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{06197EED-FF48-43F3-976D-463839D43E8C}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{06197EED-FF48-43F3-976D-463839D43E8C}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{06197EED-FF48-43F3-976D-463839D43E8C}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{82D06A2D-008D-4A4A-A83D-FB7F04721C87}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{82D06A2D-008D-4A4A-A83D-FB7F04721C87}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{82D06A2D-008D-4A4A-A83D-FB7F04721C87}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{82D06A2D-008D-4A4A-A83D-FB7F04721C87}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{33F5A50E-B823-4FDD-8571-365C909ACEAE} = {1A2F9F4A-A032-433E-B914-ADD5992BB178}
|
||||
{06197EED-FF48-43F3-976D-463839D43E8C} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD}
|
||||
{82D06A2D-008D-4A4A-A83D-FB7F04721C87} = {2E666815-2EDB-464B-9DF6-380BF4789AD4}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -4,5 +4,6 @@
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>4.1.0.0</AssemblyVersion>
|
||||
<IsNETCoreApp>true</IsNETCoreApp>
|
||||
<IsUAP>true</IsUAP>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{82D06A2D-008D-4A4A-A83D-FB7F04721C87}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Debug|AnyCPU'" />
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
CannotRemoveBaseTypeOrInterface : Type 'System.Threading.ParameterizedThreadStart' does not implement interface 'System.Runtime.Serialization.ISerializable' in the implementation but it does in the contract.
|
||||
CannotRemoveBaseTypeOrInterface : Type 'System.Threading.Thread' does not inherit from base type 'System.Runtime.ConstrainedExecution.CriticalFinalizerObject' in the implementation but it does in the contract.
|
||||
MembersMustExist : Member 'System.Threading.Thread.AllocateDataSlot()' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Threading.Thread.AllocateNamedDataSlot(System.String)' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Threading.Thread.CurrentPrincipal.get()' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Threading.Thread.CurrentPrincipal.set(System.Security.Principal.IPrincipal)' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Threading.Thread.FreeNamedDataSlot(System.String)' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Threading.Thread.GetData(System.LocalDataStoreSlot)' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Threading.Thread.GetDomain()' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Threading.Thread.GetDomainID()' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Threading.Thread.GetNamedDataSlot(System.String)' does not exist in the implementation but it does exist in the contract.
|
||||
MembersMustExist : Member 'System.Threading.Thread.SetData(System.LocalDataStoreSlot, System.Object)' does not exist in the implementation but it does exist in the contract.
|
||||
CannotRemoveBaseTypeOrInterface : Type 'System.Threading.ThreadAbortException' does not inherit from base type 'System.SystemException' in the implementation but it does in the contract.
|
||||
CannotRemoveBaseTypeOrInterface : Type 'System.Threading.ThreadExceptionEventHandler' does not implement interface 'System.Runtime.Serialization.ISerializable' in the implementation but it does in the contract.
|
||||
CannotRemoveBaseTypeOrInterface : Type 'System.Threading.ThreadInterruptedException' does not inherit from base type 'System.SystemException' in the implementation but it does in the contract.
|
||||
MembersMustExist : Member 'System.Threading.ThreadInterruptedException..ctor(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)' does not exist in the implementation but it does exist in the contract.
|
||||
CannotRemoveBaseTypeOrInterface : Type 'System.Threading.ThreadStart' does not implement interface 'System.Runtime.Serialization.ISerializable' in the implementation but it does in the contract.
|
||||
CannotRemoveBaseTypeOrInterface : Type 'System.Threading.ThreadStartException' does not inherit from base type 'System.SystemException' in the implementation but it does in the contract.
|
||||
CannotRemoveBaseTypeOrInterface : Type 'System.Threading.ThreadStateException' does not inherit from base type 'System.SystemException' in the implementation but it does in the contract.
|
||||
MembersMustExist : Member 'System.Threading.ThreadStateException..ctor(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)' does not exist in the implementation but it does exist in the contract.
|
||||
@@ -2,10 +2,10 @@
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
uap101aot-Windows_NT;
|
||||
uapaot-Windows_NT;
|
||||
uap-Windows_NT;
|
||||
netcoreapp-Windows_NT;
|
||||
netcoreapp-Unix;
|
||||
net461-Windows_NT;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,64 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
|
||||
@@ -5,24 +5,18 @@
|
||||
<AssemblyName>System.Threading.Thread</AssemblyName>
|
||||
<OutputType>Library</OutputType>
|
||||
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
|
||||
<!-- Don't allow project reference to package dependency conversion -->
|
||||
<KeepAllProjectReferences>true</KeepAllProjectReferences>
|
||||
<!-- Type being defined conflicts with imported type from dependency assembly -->
|
||||
<NoWarn>436</NoWarn>
|
||||
<ProjectGuid>{06197EED-FF48-43F3-976D-463839D43E8C}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<!-- Help VS understand available configurations -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='uap101aot-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='uap101aot-Windows_NT-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Windows_NT-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Unix-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Unix-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net461-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net461-Windows_NT-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(TargetGroup)' == 'uap101aot'">
|
||||
<DefineConstants>$(DefineConstants);NETNATIVE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' != 'net461'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Unix-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Unix-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Windows_NT-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uapaot-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uapaot-Windows_NT-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="System\LocalDataStoreSlot.cs" />
|
||||
<Compile Include="System\Threading\CompressedStack.cs" />
|
||||
<Compile Include="System\Threading\Thread.cs" />
|
||||
@@ -31,32 +25,14 @@
|
||||
<Compile Include="System\Threading\ThreadAbortException.cs" />
|
||||
<Compile Include="System\Threading\ThreadExceptionEventArgs.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
|
||||
<ProjectReference Include="..\..\System.Runtime\src\System.Runtime.csproj">
|
||||
<Aliases>System_Runtime</Aliases>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\System.Runtime.Extensions\src\System.Runtime.Extensions.csproj">
|
||||
<Aliases>System_Runtime_Extensions</Aliases>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\System.Security.Principal\src\System.Security.Principal.csproj">
|
||||
<Aliases>System_Security_Principal</Aliases>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\System.Diagnostics.Debug\src\System.Diagnostics.Debug.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' != 'net461'">
|
||||
<TargetingPackReference Include="System.Private.CoreLib" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'uap101aot'">
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\System.Runtime\src\System.Runtime.csproj" />
|
||||
<ProjectReference Include="..\..\System.Resources.ResourceManager\src\System.Resources.ResourceManager.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'net461'">
|
||||
<TargetingPackReference Include="mscorlib" />
|
||||
<TargetingPackReference Include="System" />
|
||||
<TargetingPackReference Include="System.Core" />
|
||||
<ProjectReference Include="..\..\System.Runtime.Extensions\src\System.Runtime.Extensions.csproj" />
|
||||
<ProjectReference Include="..\..\System.Security.Principal\src\System.Security.Principal.csproj" />
|
||||
<ProjectReference Include="..\..\System.Diagnostics.Debug\src\System.Diagnostics.Debug.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ReferenceFromRuntime Include="System.Private.CoreLib" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -2,38 +2,23 @@
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#if !NETNATIVE
|
||||
extern alias System_Runtime_Extensions;
|
||||
extern alias System_Security_Principal;
|
||||
#endif
|
||||
|
||||
using System.Diagnostics;
|
||||
using Internal.Runtime.Augments;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
using Internal.Runtime.Augments;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace System.Threading
|
||||
{
|
||||
#if !NETNATIVE
|
||||
using AppDomain = System_Runtime_Extensions::System.AppDomain;
|
||||
using IPrincipal = System_Security_Principal::System.Security.Principal.IPrincipal;
|
||||
#endif
|
||||
|
||||
#if !NETNATIVE
|
||||
public sealed partial class Thread : CriticalFinalizerObject
|
||||
#else
|
||||
public sealed partial class Thread
|
||||
#endif
|
||||
{
|
||||
[ThreadStatic]
|
||||
private static Thread t_currentThread;
|
||||
|
||||
private readonly RuntimeThread _runtimeThread;
|
||||
private Delegate _start;
|
||||
#if !NETNATIVE
|
||||
private IPrincipal _principal;
|
||||
#endif
|
||||
|
||||
private Thread(RuntimeThread runtimeThread)
|
||||
{
|
||||
@@ -166,7 +151,6 @@ namespace System.Threading
|
||||
}
|
||||
}
|
||||
|
||||
#if !NETNATIVE
|
||||
public static IPrincipal CurrentPrincipal
|
||||
{
|
||||
get
|
||||
@@ -178,7 +162,6 @@ namespace System.Threading
|
||||
CurrentThread._principal = value;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public ExecutionContext ExecutionContext => ExecutionContext.Capture();
|
||||
public bool IsAlive => _runtimeThread.IsAlive;
|
||||
@@ -223,14 +206,12 @@ namespace System.Threading
|
||||
public static void BeginThreadAffinity() { }
|
||||
public static void EndThreadAffinity() { }
|
||||
|
||||
#if !NETNATIVE
|
||||
public static LocalDataStoreSlot AllocateDataSlot() => LocalDataStore.AllocateSlot();
|
||||
public static LocalDataStoreSlot AllocateNamedDataSlot(string name) => LocalDataStore.AllocateNamedSlot(name);
|
||||
public static LocalDataStoreSlot GetNamedDataSlot(string name) => LocalDataStore.GetNamedSlot(name);
|
||||
public static void FreeNamedDataSlot(string name) => LocalDataStore.FreeNamedSlot(name);
|
||||
public static object GetData(LocalDataStoreSlot slot) => LocalDataStore.GetData(slot);
|
||||
public static void SetData(LocalDataStoreSlot slot, object data) => LocalDataStore.SetData(slot, data);
|
||||
#endif
|
||||
|
||||
[Obsolete("The ApartmentState property has been deprecated. Use GetApartmentState, SetApartmentState or TrySetApartmentState instead.", false)]
|
||||
public ApartmentState ApartmentState
|
||||
@@ -291,10 +272,8 @@ namespace System.Threading
|
||||
throw new InvalidOperationException(SR.Thread_GetSetCompressedStack_NotSupported);
|
||||
}
|
||||
|
||||
#if !NETNATIVE
|
||||
public static AppDomain GetDomain() => AppDomain.CurrentDomain;
|
||||
public static int GetDomainID() => GetDomain().Id;
|
||||
#endif
|
||||
public override int GetHashCode() => ManagedThreadId;
|
||||
public void Interrupt() => _runtimeThread.Interrupt();
|
||||
public void Join() => _runtimeThread.Join();
|
||||
@@ -345,7 +324,6 @@ namespace System.Threading
|
||||
[CLSCompliant(false)]
|
||||
public static void VolatileWrite(ref UIntPtr address, UIntPtr value) => Volatile.Write(ref address, value);
|
||||
|
||||
#if !NETNATIVE
|
||||
/// <summary>
|
||||
/// Manages functionality required to support members of <see cref="Thread"/> dealing with thread-local data
|
||||
/// </summary>
|
||||
@@ -426,6 +404,5 @@ namespace System.Threading
|
||||
GetThreadLocal(slot).Value = value;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,13 +6,9 @@ using System.Runtime.Serialization;
|
||||
|
||||
namespace System.Threading
|
||||
{
|
||||
// Thread.Abort() is not supported in .NET core, so this is currently just a stub to make the type available at compile time
|
||||
// Thread.Abort() is not supported in .NET Core, so this is currently just a stub to make the type available at compile time
|
||||
[Serializable]
|
||||
#if !NETNATIVE
|
||||
public sealed class ThreadAbortException : SystemException
|
||||
#else
|
||||
public sealed class ThreadAbortException : Exception
|
||||
#endif
|
||||
{
|
||||
private ThreadAbortException()
|
||||
{
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<ItemGroup>
|
||||
<Project Include="System.Threading.Thread.Tests.csproj" />
|
||||
<Project Include="System.Threading.Thread.Tests.csproj">
|
||||
<OSGroup>Windows_NT</OSGroup>
|
||||
<TestTFMs>net463</TestTFMs>
|
||||
</Project>
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
|
||||
</Project>
|
||||
@@ -3,6 +3,7 @@
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{33F5A50E-B823-4FDD-8571-365C909ACEAE}</ProjectGuid>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<!-- Default configurations to help VS understand the configurations -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard-Debug|AnyCPU'" />
|
||||
@@ -18,8 +19,5 @@
|
||||
<Link>CommonTest\System\Threading\ThreadPoolHelpers.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
|
||||
@@ -20,10 +20,34 @@ namespace System.Threading.Threads.Tests
|
||||
[Fact]
|
||||
public static void ConstructorTest()
|
||||
{
|
||||
var t = new Thread(() => { });
|
||||
t = new Thread(() => { }, 0);
|
||||
t = new Thread(state => { });
|
||||
t = new Thread(state => { }, 0);
|
||||
Action<Thread> startThreadAndJoin =
|
||||
t =>
|
||||
{
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
Assert.True(t.Join(UnexpectedTimeoutMilliseconds));
|
||||
};
|
||||
Action<int> verifyStackSize =
|
||||
stackSizeBytes =>
|
||||
{
|
||||
// Try to stack-allocate an array to verify that close to the expected amount of stack space is actually
|
||||
// available
|
||||
int bufferSizeBytes = Math.Max(16 << 10, stackSizeBytes - (64 << 10));
|
||||
unsafe
|
||||
{
|
||||
byte* buffer = stackalloc byte[bufferSizeBytes];
|
||||
Volatile.Write(ref buffer[0], 0xff);
|
||||
Volatile.Write(ref buffer[bufferSizeBytes - 1], 0xff);
|
||||
}
|
||||
};
|
||||
startThreadAndJoin(new Thread(() => verifyStackSize(0)));
|
||||
startThreadAndJoin(new Thread(() => verifyStackSize(0), 0));
|
||||
startThreadAndJoin(new Thread(() => verifyStackSize(64 << 10), 64 << 10)); // 64 KB
|
||||
startThreadAndJoin(new Thread(() => verifyStackSize(16 << 20), 16 << 20)); // 16 MB
|
||||
startThreadAndJoin(new Thread(state => verifyStackSize(0)));
|
||||
startThreadAndJoin(new Thread(state => verifyStackSize(0), 0));
|
||||
startThreadAndJoin(new Thread(state => verifyStackSize(64 << 10), 64 << 10)); // 64 KB
|
||||
startThreadAndJoin(new Thread(state => verifyStackSize(16 << 20), 16 << 20)); // 16 MB
|
||||
|
||||
Assert.Throws<ArgumentNullException>(() => new Thread((ThreadStart)null));
|
||||
Assert.Throws<ArgumentNullException>(() => new Thread((ThreadStart)null, 0));
|
||||
@@ -116,7 +140,7 @@ namespace System.Threading.Threads.Tests
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(ApartmentStateTest_MemberData))]
|
||||
[PlatformSpecific(TestPlatforms.Windows)]
|
||||
[PlatformSpecific(TestPlatforms.Windows)] // Expected behavior differs on Unix and Windows
|
||||
public static void GetSetApartmentStateTest_ChangeAfterThreadStarted_Windows(
|
||||
Func<Thread, ApartmentState> getApartmentState,
|
||||
Func<Thread, ApartmentState, int> setApartmentState,
|
||||
@@ -138,7 +162,7 @@ namespace System.Threading.Threads.Tests
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(ApartmentStateTest_MemberData))]
|
||||
[PlatformSpecific(TestPlatforms.Windows)]
|
||||
[PlatformSpecific(TestPlatforms.Windows)] // Expected behavior differs on Unix and Windows
|
||||
public static void ApartmentStateTest_ChangeBeforeThreadStarted_Windows(
|
||||
Func<Thread, ApartmentState> getApartmentState,
|
||||
Func<Thread, ApartmentState, int> setApartmentState,
|
||||
@@ -153,13 +177,13 @@ namespace System.Threading.Threads.Tests
|
||||
Assert.Equal(setType == 0 ? 0 : 2, setApartmentState(t, ApartmentState.MTA)); // cannot be changed more than once
|
||||
Assert.Equal(ApartmentState.STA, getApartmentState(t));
|
||||
t.Start();
|
||||
t.Join(UnexpectedTimeoutMilliseconds);
|
||||
Assert.True(t.Join(UnexpectedTimeoutMilliseconds));
|
||||
Assert.Equal(ApartmentState.STA, apartmentStateInThread);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(ApartmentStateTest_MemberData))]
|
||||
[PlatformSpecific(TestPlatforms.AnyUnix)]
|
||||
[PlatformSpecific(TestPlatforms.AnyUnix)] // Expected behavior differs on Unix and Windows
|
||||
public static void ApartmentStateTest_Unix(
|
||||
Func<Thread, ApartmentState> getApartmentState,
|
||||
Func<Thread, ApartmentState, int> setApartmentState,
|
||||
@@ -269,7 +293,7 @@ namespace System.Threading.Threads.Tests
|
||||
var t = new Thread(() => otherThread = Thread.CurrentThread);
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
t.Join(UnexpectedTimeoutMilliseconds);
|
||||
Assert.True(t.Join(UnexpectedTimeoutMilliseconds));
|
||||
|
||||
Assert.Equal(t, otherThread);
|
||||
|
||||
@@ -296,7 +320,7 @@ namespace System.Threading.Threads.Tests
|
||||
|
||||
Assert.False(t.IsAlive);
|
||||
t.Start();
|
||||
t.Join(UnexpectedTimeoutMilliseconds);
|
||||
Assert.True(t.Join(UnexpectedTimeoutMilliseconds));
|
||||
Assert.True(isAliveWhenRunning);
|
||||
Assert.False(t.IsAlive);
|
||||
}
|
||||
@@ -309,7 +333,7 @@ namespace System.Threading.Threads.Tests
|
||||
t.IsBackground = true;
|
||||
Assert.True(t.IsBackground);
|
||||
t.Start();
|
||||
t.Join(UnexpectedTimeoutMilliseconds);
|
||||
Assert.True(t.Join(UnexpectedTimeoutMilliseconds));
|
||||
|
||||
// Cannot use this property after the thread is dead
|
||||
Assert.Throws<ThreadStateException>(() => t.IsBackground);
|
||||
@@ -332,7 +356,7 @@ namespace System.Threading.Threads.Tests
|
||||
Assert.False(t.IsThreadPoolThread);
|
||||
|
||||
t.Start();
|
||||
t.Join(UnexpectedTimeoutMilliseconds);
|
||||
Assert.True(t.Join(UnexpectedTimeoutMilliseconds));
|
||||
Assert.False(isThreadPoolThread);
|
||||
|
||||
var e = new ManualResetEvent(false);
|
||||
|
||||
Reference in New Issue
Block a user