You've already forked linux-packaging-mono
Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
parent
1190d13a04
commit
6bdd276d05
8
external/corefx/src/System.Threading.Thread/dir.props
vendored
Normal file
8
external/corefx/src/System.Threading.Thread/dir.props
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\dir.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>4.1.0.0</AssemblyVersion>
|
||||
<IsNETCoreApp>true</IsNETCoreApp>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
9
external/corefx/src/System.Threading.Thread/ref/Configurations.props
vendored
Normal file
9
external/corefx/src/System.Threading.Thread/ref/Configurations.props
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
netcoreapp;
|
||||
uap;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
183
external/corefx/src/System.Threading.Thread/ref/System.Threading.Thread.cs
vendored
Normal file
183
external/corefx/src/System.Threading.Thread/ref/System.Threading.Thread.cs
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
// 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.
|
||||
// ------------------------------------------------------------------------------
|
||||
// Changes to this file must follow the http://aka.ms/api-review process.
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
namespace System
|
||||
{
|
||||
public sealed partial class LocalDataStoreSlot
|
||||
{
|
||||
private LocalDataStoreSlot() { }
|
||||
~LocalDataStoreSlot() { }
|
||||
}
|
||||
}
|
||||
namespace System.Threading
|
||||
{
|
||||
public enum ApartmentState
|
||||
{
|
||||
MTA = 1,
|
||||
STA = 0,
|
||||
Unknown = 2,
|
||||
}
|
||||
public sealed partial class CompressedStack : System.Runtime.Serialization.ISerializable
|
||||
{
|
||||
private CompressedStack() { }
|
||||
public static System.Threading.CompressedStack Capture() { throw null; }
|
||||
public System.Threading.CompressedStack CreateCopy() { throw null; }
|
||||
public static System.Threading.CompressedStack GetCompressedStack() { throw null; }
|
||||
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
|
||||
public static void Run(System.Threading.CompressedStack compressedStack, System.Threading.ContextCallback callback, object state) { }
|
||||
}
|
||||
public delegate void ParameterizedThreadStart(object obj);
|
||||
public sealed partial class Thread : System.Runtime.ConstrainedExecution.CriticalFinalizerObject
|
||||
{
|
||||
public Thread(System.Threading.ParameterizedThreadStart start) { }
|
||||
public Thread(System.Threading.ParameterizedThreadStart start, int maxStackSize) { }
|
||||
public Thread(System.Threading.ThreadStart start) { }
|
||||
public Thread(System.Threading.ThreadStart start, int maxStackSize) { }
|
||||
[System.ObsoleteAttribute("The ApartmentState property has been deprecated. Use GetApartmentState, SetApartmentState or TrySetApartmentState instead.", false)]
|
||||
public System.Threading.ApartmentState ApartmentState { get { throw null; } set { } }
|
||||
public System.Globalization.CultureInfo CurrentCulture { get { throw null; } set { } }
|
||||
public static System.Security.Principal.IPrincipal CurrentPrincipal { get { throw null; } set { } }
|
||||
public static System.Threading.Thread CurrentThread { get { throw null; } }
|
||||
public System.Globalization.CultureInfo CurrentUICulture { get { throw null; } set { } }
|
||||
public System.Threading.ExecutionContext ExecutionContext { get { throw null; } }
|
||||
public bool IsAlive { get { throw null; } }
|
||||
public bool IsBackground { get { throw null; } set { } }
|
||||
public bool IsThreadPoolThread { get { throw null; } }
|
||||
public int ManagedThreadId { get { throw null; } }
|
||||
public string Name { get { throw null; } set { } }
|
||||
public System.Threading.ThreadPriority Priority { get { throw null; } set { } }
|
||||
public System.Threading.ThreadState ThreadState { get { throw null; } }
|
||||
public void Abort() { }
|
||||
public void Abort(object stateInfo) { }
|
||||
public static System.LocalDataStoreSlot AllocateDataSlot() { throw null; }
|
||||
public static System.LocalDataStoreSlot AllocateNamedDataSlot(string name) { throw null; }
|
||||
public static void BeginCriticalRegion() { }
|
||||
public static void BeginThreadAffinity() { }
|
||||
public void DisableComObjectEagerCleanup() { }
|
||||
public static void EndCriticalRegion() { }
|
||||
public static void EndThreadAffinity() { }
|
||||
~Thread() { }
|
||||
public static void FreeNamedDataSlot(string name) { }
|
||||
public System.Threading.ApartmentState GetApartmentState() { throw null; }
|
||||
[System.ObsoleteAttribute("Thread.GetCompressedStack is no longer supported. Please use the System.Threading.CompressedStack class")]
|
||||
public System.Threading.CompressedStack GetCompressedStack() { throw null; }
|
||||
public static object GetData(System.LocalDataStoreSlot slot) { throw null; }
|
||||
public static System.AppDomain GetDomain() { throw null; }
|
||||
public static int GetDomainID() { throw null; }
|
||||
public override int GetHashCode() { throw null; }
|
||||
public static System.LocalDataStoreSlot GetNamedDataSlot(string name) { throw null; }
|
||||
public void Interrupt() { }
|
||||
public void Join() { }
|
||||
public bool Join(int millisecondsTimeout) { throw null; }
|
||||
public bool Join(System.TimeSpan timeout) { throw null; }
|
||||
public static void MemoryBarrier() { }
|
||||
public static void ResetAbort() { }
|
||||
[System.ObsoleteAttribute("Thread.Resume has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources. http://go.microsoft.com/fwlink/?linkid=14202", false)]
|
||||
public void Resume() { }
|
||||
public void SetApartmentState(System.Threading.ApartmentState state) { }
|
||||
[System.ObsoleteAttribute("Thread.SetCompressedStack is no longer supported. Please use the System.Threading.CompressedStack class")]
|
||||
public void SetCompressedStack(System.Threading.CompressedStack stack) { }
|
||||
public static void SetData(System.LocalDataStoreSlot slot, object data) { }
|
||||
public static void Sleep(int millisecondsTimeout) { }
|
||||
public static void Sleep(System.TimeSpan timeout) { }
|
||||
public static void SpinWait(int iterations) { }
|
||||
public void Start() { }
|
||||
public void Start(object parameter) { }
|
||||
[System.ObsoleteAttribute("Thread.Suspend has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources. http://go.microsoft.com/fwlink/?linkid=14202", false)]
|
||||
public void Suspend() { }
|
||||
public bool TrySetApartmentState(System.Threading.ApartmentState state) { throw null; }
|
||||
public static byte VolatileRead(ref byte address) { throw null; }
|
||||
public static double VolatileRead(ref double address) { throw null; }
|
||||
public static short VolatileRead(ref short address) { throw null; }
|
||||
public static int VolatileRead(ref int address) { throw null; }
|
||||
public static long VolatileRead(ref long address) { throw null; }
|
||||
public static System.IntPtr VolatileRead(ref System.IntPtr address) { throw null; }
|
||||
public static object VolatileRead(ref object address) { throw null; }
|
||||
[System.CLSCompliantAttribute(false)]
|
||||
public static sbyte VolatileRead(ref sbyte address) { throw null; }
|
||||
public static float VolatileRead(ref float address) { throw null; }
|
||||
[System.CLSCompliantAttribute(false)]
|
||||
public static ushort VolatileRead(ref ushort address) { throw null; }
|
||||
[System.CLSCompliantAttribute(false)]
|
||||
public static uint VolatileRead(ref uint address) { throw null; }
|
||||
[System.CLSCompliantAttribute(false)]
|
||||
public static ulong VolatileRead(ref ulong address) { throw null; }
|
||||
[System.CLSCompliantAttribute(false)]
|
||||
public static System.UIntPtr VolatileRead(ref System.UIntPtr address) { throw null; }
|
||||
public static void VolatileWrite(ref byte address, byte value) { }
|
||||
public static void VolatileWrite(ref double address, double value) { }
|
||||
public static void VolatileWrite(ref short address, short value) { }
|
||||
public static void VolatileWrite(ref int address, int value) { }
|
||||
public static void VolatileWrite(ref long address, long value) { }
|
||||
public static void VolatileWrite(ref System.IntPtr address, System.IntPtr value) { }
|
||||
public static void VolatileWrite(ref object address, object value) { }
|
||||
[System.CLSCompliantAttribute(false)]
|
||||
public static void VolatileWrite(ref sbyte address, sbyte value) { }
|
||||
public static void VolatileWrite(ref float address, float value) { }
|
||||
[System.CLSCompliantAttribute(false)]
|
||||
public static void VolatileWrite(ref ushort address, ushort value) { }
|
||||
[System.CLSCompliantAttribute(false)]
|
||||
public static void VolatileWrite(ref uint address, uint value) { }
|
||||
[System.CLSCompliantAttribute(false)]
|
||||
public static void VolatileWrite(ref ulong address, ulong value) { }
|
||||
[System.CLSCompliantAttribute(false)]
|
||||
public static void VolatileWrite(ref System.UIntPtr address, System.UIntPtr value) { }
|
||||
public static bool Yield() { throw null; }
|
||||
}
|
||||
public sealed partial class ThreadAbortException : System.SystemException
|
||||
{
|
||||
private ThreadAbortException() { }
|
||||
public object ExceptionState { get { throw null; } }
|
||||
}
|
||||
public partial class ThreadExceptionEventArgs : System.EventArgs
|
||||
{
|
||||
public ThreadExceptionEventArgs(System.Exception t) { }
|
||||
public System.Exception Exception { get { throw null; } }
|
||||
}
|
||||
public delegate void ThreadExceptionEventHandler(object sender, System.Threading.ThreadExceptionEventArgs e);
|
||||
public partial class ThreadInterruptedException : System.SystemException
|
||||
{
|
||||
public ThreadInterruptedException() { }
|
||||
public ThreadInterruptedException(string message) { }
|
||||
public ThreadInterruptedException(string message, System.Exception innerException) { }
|
||||
protected ThreadInterruptedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
|
||||
}
|
||||
public enum ThreadPriority
|
||||
{
|
||||
AboveNormal = 3,
|
||||
BelowNormal = 1,
|
||||
Highest = 4,
|
||||
Lowest = 0,
|
||||
Normal = 2,
|
||||
}
|
||||
public delegate void ThreadStart();
|
||||
public sealed partial class ThreadStartException : System.SystemException
|
||||
{
|
||||
internal ThreadStartException() { }
|
||||
}
|
||||
[System.FlagsAttribute]
|
||||
public enum ThreadState
|
||||
{
|
||||
Aborted = 256,
|
||||
AbortRequested = 128,
|
||||
Background = 4,
|
||||
Running = 0,
|
||||
Stopped = 16,
|
||||
StopRequested = 1,
|
||||
Suspended = 64,
|
||||
SuspendRequested = 2,
|
||||
Unstarted = 8,
|
||||
WaitSleepJoin = 32,
|
||||
}
|
||||
public partial class ThreadStateException : System.SystemException
|
||||
{
|
||||
public ThreadStateException() { }
|
||||
public ThreadStateException(string message) { }
|
||||
public ThreadStateException(string message, System.Exception innerException) { }
|
||||
protected ThreadStateException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
|
||||
}
|
||||
}
|
||||
18
external/corefx/src/System.Threading.Thread/ref/System.Threading.Thread.csproj
vendored
Normal file
18
external/corefx/src/System.Threading.Thread/ref/System.Threading.Thread.csproj
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?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 Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="System.Threading.Thread.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
|
||||
<ProjectReference Include="..\..\System.Runtime.Extensions\ref\System.Runtime.Extensions.csproj" />
|
||||
<ProjectReference Include="..\..\System.Security.Principal\ref\System.Security.Principal.csproj" />
|
||||
<ProjectReference Include="..\..\System.Threading\ref\System.Threading.csproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
20
external/corefx/src/System.Threading.Thread/src/ApiCompatBaseline.uap101aot.txt
vendored
Normal file
20
external/corefx/src/System.Threading.Thread/src/ApiCompatBaseline.uap101aot.txt
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
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.
|
||||
11
external/corefx/src/System.Threading.Thread/src/Configurations.props
vendored
Normal file
11
external/corefx/src/System.Threading.Thread/src/Configurations.props
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
uap101aot-Windows_NT;
|
||||
netcoreapp-Windows_NT;
|
||||
netcoreapp-Unix;
|
||||
net461-Windows_NT;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
138
external/corefx/src/System.Threading.Thread/src/Resources/Strings.resx
vendored
Normal file
138
external/corefx/src/System.Threading.Thread/src/Resources/Strings.resx
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
<?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">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Thread_Operation_RequiresCurrentThread" xml:space="preserve">
|
||||
<value>This operation must be performed on the same thread as that represented by the Thread instance.</value>
|
||||
</data>
|
||||
<data name="ArgumentOutOfRange_Enum" xml:space="preserve">
|
||||
<value>Enum value was out of legal range.</value>
|
||||
</data>
|
||||
<data name="Thread_ApartmentState_ChangeFailed" xml:space="preserve">
|
||||
<value>Failed to set the specified COM apartment state.</value>
|
||||
</data>
|
||||
<data name="ArgumentOutOfRange_TimeoutMilliseconds" xml:space="preserve">
|
||||
<value>Timeout value in milliseconds must be nonnegative and less than or equal to Int32.MaxValue, or -1 for an infinite timeout.</value>
|
||||
</data>
|
||||
<data name="ArgumentOutOfRange_NeedNonnegativeNumber" xml:space="preserve">
|
||||
<value>Nonnegative number required.</value>
|
||||
</data>
|
||||
<data name="Thread_GetSetCompressedStack_NotSupported" xml:space="preserve">
|
||||
<value>Use CompressedStack.(Capture/Run) instead.</value>
|
||||
</data>
|
||||
</root>
|
||||
62
external/corefx/src/System.Threading.Thread/src/System.Threading.Thread.csproj
vendored
Normal file
62
external/corefx/src/System.Threading.Thread/src/System.Threading.Thread.csproj
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
<?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" />
|
||||
<PropertyGroup>
|
||||
<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>
|
||||
</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'">
|
||||
<Compile Include="System\LocalDataStoreSlot.cs" />
|
||||
<Compile Include="System\Threading\CompressedStack.cs" />
|
||||
<Compile Include="System\Threading\Thread.cs" />
|
||||
<Compile Include="System\Threading\Thread.Unix.cs" Condition="'$(TargetsUnix)' == 'true'" />
|
||||
<Compile Include="System\Threading\Thread.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
|
||||
<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'">
|
||||
<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" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ReferenceFromRuntime Include="System.Private.CoreLib" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
24
external/corefx/src/System.Threading.Thread/src/System/LocalDataStoreSlot.cs
vendored
Normal file
24
external/corefx/src/System.Threading.Thread/src/System/LocalDataStoreSlot.cs
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
// 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.
|
||||
|
||||
using System.Threading;
|
||||
|
||||
namespace System
|
||||
{
|
||||
public sealed class LocalDataStoreSlot
|
||||
{
|
||||
internal LocalDataStoreSlot(ThreadLocal<object> data)
|
||||
{
|
||||
Data = data;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
internal ThreadLocal<object> Data { get; private set; }
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA1821", Justification = "Finalizer preserved for compat, it is suppressed by the constructor.")]
|
||||
~LocalDataStoreSlot()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
54
external/corefx/src/System.Threading.Thread/src/System/Threading/CompressedStack.cs
vendored
Normal file
54
external/corefx/src/System.Threading.Thread/src/System/Threading/CompressedStack.cs
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
// 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.
|
||||
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.Threading
|
||||
{
|
||||
[Serializable]
|
||||
public sealed class CompressedStack : ISerializable
|
||||
{
|
||||
private CompressedStack()
|
||||
{
|
||||
}
|
||||
|
||||
private CompressedStack(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
}
|
||||
|
||||
public void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(info));
|
||||
}
|
||||
}
|
||||
|
||||
public static CompressedStack Capture()
|
||||
{
|
||||
return GetCompressedStack();
|
||||
}
|
||||
|
||||
public CompressedStack CreateCopy()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public static CompressedStack GetCompressedStack()
|
||||
{
|
||||
return new CompressedStack();
|
||||
}
|
||||
|
||||
public static void Run(CompressedStack compressedStack, ContextCallback callback, object state)
|
||||
{
|
||||
if (compressedStack == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(compressedStack));
|
||||
}
|
||||
|
||||
// The original code was not checking for a null callback and would throw NullReferenceException
|
||||
callback(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
17
external/corefx/src/System.Threading.Thread/src/System/Threading/Thread.Unix.cs
vendored
Normal file
17
external/corefx/src/System.Threading.Thread/src/System/Threading/Thread.Unix.cs
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// 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.
|
||||
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
|
||||
namespace System.Threading
|
||||
{
|
||||
public sealed partial class Thread
|
||||
{
|
||||
public ApartmentState GetApartmentState() => ApartmentState.Unknown;
|
||||
private static Exception GetApartmentStateChangeFailedException() => new PlatformNotSupportedException();
|
||||
private bool TrySetApartmentStateUnchecked(ApartmentState state) => state == GetApartmentState();
|
||||
|
||||
public void DisableComObjectEagerCleanup() { }
|
||||
}
|
||||
}
|
||||
18
external/corefx/src/System.Threading.Thread/src/System/Threading/Thread.Windows.cs
vendored
Normal file
18
external/corefx/src/System.Threading.Thread/src/System/Threading/Thread.Windows.cs
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// 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.
|
||||
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
|
||||
namespace System.Threading
|
||||
{
|
||||
public sealed partial class Thread
|
||||
{
|
||||
public ApartmentState GetApartmentState() => _runtimeThread.GetApartmentState();
|
||||
private static Exception GetApartmentStateChangeFailedException() =>
|
||||
new InvalidOperationException(SR.Thread_ApartmentState_ChangeFailed);
|
||||
private bool TrySetApartmentStateUnchecked(ApartmentState state) => _runtimeThread.TrySetApartmentState(state);
|
||||
|
||||
public void DisableComObjectEagerCleanup() => _runtimeThread.DisableComObjectEagerCleanup();
|
||||
}
|
||||
}
|
||||
431
external/corefx/src/System.Threading.Thread/src/System/Threading/Thread.cs
vendored
Normal file
431
external/corefx/src/System.Threading.Thread/src/System/Threading/Thread.cs
vendored
Normal file
@@ -0,0 +1,431 @@
|
||||
// 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.
|
||||
|
||||
#if !NETNATIVE
|
||||
extern alias System_Runtime_Extensions;
|
||||
extern alias System_Security_Principal;
|
||||
#endif
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
using Internal.Runtime.Augments;
|
||||
|
||||
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)
|
||||
{
|
||||
Debug.Assert(runtimeThread != null);
|
||||
_runtimeThread = runtimeThread;
|
||||
}
|
||||
|
||||
public Thread(ThreadStart start)
|
||||
{
|
||||
if (start == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(start));
|
||||
}
|
||||
|
||||
_runtimeThread = RuntimeThread.Create(ThreadMain_ThreadStart);
|
||||
Debug.Assert(_runtimeThread != null);
|
||||
_start = start;
|
||||
}
|
||||
|
||||
public Thread(ThreadStart start, int maxStackSize)
|
||||
{
|
||||
if (start == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(start));
|
||||
}
|
||||
if (maxStackSize < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(maxStackSize), SR.ArgumentOutOfRange_NeedNonnegativeNumber);
|
||||
}
|
||||
|
||||
_runtimeThread = RuntimeThread.Create(ThreadMain_ThreadStart, maxStackSize);
|
||||
Debug.Assert(_runtimeThread != null);
|
||||
_start = start;
|
||||
}
|
||||
|
||||
public Thread(ParameterizedThreadStart start)
|
||||
{
|
||||
if (start == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(start));
|
||||
}
|
||||
|
||||
_runtimeThread = RuntimeThread.Create(ThreadMain_ParameterizedThreadStart);
|
||||
Debug.Assert(_runtimeThread != null);
|
||||
_start = start;
|
||||
}
|
||||
|
||||
public Thread(ParameterizedThreadStart start, int maxStackSize)
|
||||
{
|
||||
if (start == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(start));
|
||||
}
|
||||
if (maxStackSize < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(maxStackSize), SR.ArgumentOutOfRange_NeedNonnegativeNumber);
|
||||
}
|
||||
|
||||
_runtimeThread = RuntimeThread.Create(ThreadMain_ParameterizedThreadStart, maxStackSize);
|
||||
Debug.Assert(_runtimeThread != null);
|
||||
_start = start;
|
||||
}
|
||||
|
||||
private void ThreadMain_ThreadStart()
|
||||
{
|
||||
t_currentThread = this;
|
||||
|
||||
Delegate start = _start;
|
||||
_start = null;
|
||||
Debug.Assert(start is ThreadStart);
|
||||
((ThreadStart)start)();
|
||||
}
|
||||
|
||||
private void ThreadMain_ParameterizedThreadStart(object parameter)
|
||||
{
|
||||
t_currentThread = this;
|
||||
|
||||
Delegate start = _start;
|
||||
_start = null;
|
||||
Debug.Assert(start is ParameterizedThreadStart);
|
||||
((ParameterizedThreadStart)start)(parameter);
|
||||
}
|
||||
|
||||
public static Thread CurrentThread
|
||||
{
|
||||
get
|
||||
{
|
||||
Thread currentThread = t_currentThread;
|
||||
if (currentThread == null)
|
||||
{
|
||||
t_currentThread = currentThread = new Thread(RuntimeThread.CurrentThread);
|
||||
}
|
||||
return currentThread;
|
||||
}
|
||||
}
|
||||
|
||||
private void RequireCurrentThread()
|
||||
{
|
||||
if (this != CurrentThread)
|
||||
{
|
||||
throw new InvalidOperationException(SR.Thread_Operation_RequiresCurrentThread);
|
||||
}
|
||||
}
|
||||
|
||||
public CultureInfo CurrentCulture
|
||||
{
|
||||
get
|
||||
{
|
||||
RequireCurrentThread();
|
||||
return CultureInfo.CurrentCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
RequireCurrentThread();
|
||||
CultureInfo.CurrentCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
public CultureInfo CurrentUICulture
|
||||
{
|
||||
get
|
||||
{
|
||||
RequireCurrentThread();
|
||||
return CultureInfo.CurrentUICulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
RequireCurrentThread();
|
||||
CultureInfo.CurrentUICulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
#if !NETNATIVE
|
||||
public static IPrincipal CurrentPrincipal
|
||||
{
|
||||
get
|
||||
{
|
||||
return CurrentThread._principal;
|
||||
}
|
||||
set
|
||||
{
|
||||
CurrentThread._principal = value;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public ExecutionContext ExecutionContext => ExecutionContext.Capture();
|
||||
public bool IsAlive => _runtimeThread.IsAlive;
|
||||
public bool IsBackground { get { return _runtimeThread.IsBackground; } set { _runtimeThread.IsBackground = value; } }
|
||||
public bool IsThreadPoolThread => _runtimeThread.IsThreadPoolThread;
|
||||
public int ManagedThreadId => _runtimeThread.ManagedThreadId;
|
||||
public string Name { get { return _runtimeThread.Name; } set { _runtimeThread.Name = value; } }
|
||||
public ThreadPriority Priority { get { return _runtimeThread.Priority; } set { _runtimeThread.Priority = value; } }
|
||||
public ThreadState ThreadState => _runtimeThread.ThreadState;
|
||||
|
||||
public void Abort()
|
||||
{
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
|
||||
public void Abort(object stateInfo)
|
||||
{
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
|
||||
public static void ResetAbort()
|
||||
{
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
|
||||
[ObsoleteAttribute("Thread.Suspend has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources. http://go.microsoft.com/fwlink/?linkid=14202", false)]
|
||||
public void Suspend()
|
||||
{
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
|
||||
[ObsoleteAttribute("Thread.Resume has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources. http://go.microsoft.com/fwlink/?linkid=14202", false)]
|
||||
public void Resume()
|
||||
{
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
|
||||
// Currently, no special handling is done for critical regions, and no special handling is necessary to ensure thread
|
||||
// affinity. If that changes, the relevant functions would instead need to delegate to RuntimeThread.
|
||||
public static void BeginCriticalRegion() { }
|
||||
public static void EndCriticalRegion() { }
|
||||
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
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetApartmentState();
|
||||
}
|
||||
set
|
||||
{
|
||||
TrySetApartmentState(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetApartmentState(ApartmentState state)
|
||||
{
|
||||
if (!TrySetApartmentState(state))
|
||||
{
|
||||
throw GetApartmentStateChangeFailedException();
|
||||
}
|
||||
}
|
||||
|
||||
public bool TrySetApartmentState(ApartmentState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case ApartmentState.STA:
|
||||
case ApartmentState.MTA:
|
||||
case ApartmentState.Unknown:
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(SR.ArgumentOutOfRange_Enum, nameof(state));
|
||||
}
|
||||
|
||||
return TrySetApartmentStateUnchecked(state);
|
||||
}
|
||||
|
||||
private static int ToTimeoutMilliseconds(TimeSpan timeout)
|
||||
{
|
||||
var timeoutMilliseconds = (long)timeout.TotalMilliseconds;
|
||||
if (timeoutMilliseconds < -1 || timeoutMilliseconds > int.MaxValue)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_TimeoutMilliseconds);
|
||||
}
|
||||
return (int)timeoutMilliseconds;
|
||||
}
|
||||
|
||||
[Obsolete("Thread.GetCompressedStack is no longer supported. Please use the System.Threading.CompressedStack class")]
|
||||
public CompressedStack GetCompressedStack()
|
||||
{
|
||||
throw new InvalidOperationException(SR.Thread_GetSetCompressedStack_NotSupported);
|
||||
}
|
||||
|
||||
[Obsolete("Thread.SetCompressedStack is no longer supported. Please use the System.Threading.CompressedStack class")]
|
||||
public void SetCompressedStack(CompressedStack stack)
|
||||
{
|
||||
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();
|
||||
public bool Join(int millisecondsTimeout) => _runtimeThread.Join(millisecondsTimeout);
|
||||
public bool Join(TimeSpan timeout) => Join(ToTimeoutMilliseconds(timeout));
|
||||
public static void MemoryBarrier() => Interlocked.MemoryBarrier();
|
||||
public static void Sleep(int millisecondsTimeout) => RuntimeThread.Sleep(millisecondsTimeout);
|
||||
public static void Sleep(TimeSpan timeout) => Sleep(ToTimeoutMilliseconds(timeout));
|
||||
public static void SpinWait(int iterations) => RuntimeThread.SpinWait(iterations);
|
||||
public static bool Yield() => RuntimeThread.Yield();
|
||||
public void Start() => _runtimeThread.Start();
|
||||
public void Start(object parameter) => _runtimeThread.Start(parameter);
|
||||
|
||||
public static byte VolatileRead(ref byte address) => Volatile.Read(ref address);
|
||||
public static double VolatileRead(ref double address) => Volatile.Read(ref address);
|
||||
public static short VolatileRead(ref short address) => Volatile.Read(ref address);
|
||||
public static int VolatileRead(ref int address) => Volatile.Read(ref address);
|
||||
public static long VolatileRead(ref long address) => Volatile.Read(ref address);
|
||||
public static IntPtr VolatileRead(ref IntPtr address) => Volatile.Read(ref address);
|
||||
public static object VolatileRead(ref object address) => Volatile.Read(ref address);
|
||||
[CLSCompliant(false)]
|
||||
public static sbyte VolatileRead(ref sbyte address) => Volatile.Read(ref address);
|
||||
public static float VolatileRead(ref float address) => Volatile.Read(ref address);
|
||||
[CLSCompliant(false)]
|
||||
public static ushort VolatileRead(ref ushort address) => Volatile.Read(ref address);
|
||||
[CLSCompliant(false)]
|
||||
public static uint VolatileRead(ref uint address) => Volatile.Read(ref address);
|
||||
[CLSCompliant(false)]
|
||||
public static ulong VolatileRead(ref ulong address) => Volatile.Read(ref address);
|
||||
[CLSCompliant(false)]
|
||||
public static UIntPtr VolatileRead(ref UIntPtr address) => Volatile.Read(ref address);
|
||||
public static void VolatileWrite(ref byte address, byte value) => Volatile.Write(ref address, value);
|
||||
public static void VolatileWrite(ref double address, double value) => Volatile.Write(ref address, value);
|
||||
public static void VolatileWrite(ref short address, short value) => Volatile.Write(ref address, value);
|
||||
public static void VolatileWrite(ref int address, int value) => Volatile.Write(ref address, value);
|
||||
public static void VolatileWrite(ref long address, long value) => Volatile.Write(ref address, value);
|
||||
public static void VolatileWrite(ref IntPtr address, IntPtr value) => Volatile.Write(ref address, value);
|
||||
public static void VolatileWrite(ref object address, object value) => Volatile.Write(ref address, value);
|
||||
[CLSCompliant(false)]
|
||||
public static void VolatileWrite(ref sbyte address, sbyte value) => Volatile.Write(ref address, value);
|
||||
public static void VolatileWrite(ref float address, float value) => Volatile.Write(ref address, value);
|
||||
[CLSCompliant(false)]
|
||||
public static void VolatileWrite(ref ushort address, ushort value) => Volatile.Write(ref address, value);
|
||||
[CLSCompliant(false)]
|
||||
public static void VolatileWrite(ref uint address, uint value) => Volatile.Write(ref address, value);
|
||||
[CLSCompliant(false)]
|
||||
public static void VolatileWrite(ref ulong address, ulong value) => Volatile.Write(ref address, value);
|
||||
[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>
|
||||
private static class LocalDataStore
|
||||
{
|
||||
private static Dictionary<string, LocalDataStoreSlot> s_nameToSlotMap;
|
||||
|
||||
public static LocalDataStoreSlot AllocateSlot()
|
||||
{
|
||||
return new LocalDataStoreSlot(new ThreadLocal<object>());
|
||||
}
|
||||
|
||||
public static Dictionary<string, LocalDataStoreSlot> EnsureNameToSlotMap()
|
||||
{
|
||||
Dictionary<string, LocalDataStoreSlot> nameToSlotMap = s_nameToSlotMap;
|
||||
if (nameToSlotMap != null)
|
||||
{
|
||||
return nameToSlotMap;
|
||||
}
|
||||
|
||||
nameToSlotMap = new Dictionary<string, LocalDataStoreSlot>();
|
||||
return Interlocked.CompareExchange(ref s_nameToSlotMap, nameToSlotMap, null) ?? nameToSlotMap;
|
||||
}
|
||||
|
||||
public static LocalDataStoreSlot AllocateNamedSlot(string name)
|
||||
{
|
||||
LocalDataStoreSlot slot = AllocateSlot();
|
||||
Dictionary<string, LocalDataStoreSlot> nameToSlotMap = EnsureNameToSlotMap();
|
||||
lock (nameToSlotMap)
|
||||
{
|
||||
nameToSlotMap.Add(name, slot);
|
||||
}
|
||||
return slot;
|
||||
}
|
||||
|
||||
public static LocalDataStoreSlot GetNamedSlot(string name)
|
||||
{
|
||||
Dictionary<string, LocalDataStoreSlot> nameToSlotMap = EnsureNameToSlotMap();
|
||||
lock (nameToSlotMap)
|
||||
{
|
||||
LocalDataStoreSlot slot;
|
||||
if (!nameToSlotMap.TryGetValue(name, out slot))
|
||||
{
|
||||
slot = AllocateSlot();
|
||||
nameToSlotMap[name] = slot;
|
||||
}
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
|
||||
public static void FreeNamedSlot(string name)
|
||||
{
|
||||
Dictionary<string, LocalDataStoreSlot> nameToSlotMap = EnsureNameToSlotMap();
|
||||
lock (nameToSlotMap)
|
||||
{
|
||||
nameToSlotMap.Remove(name);
|
||||
}
|
||||
}
|
||||
|
||||
private static ThreadLocal<object> GetThreadLocal(LocalDataStoreSlot slot)
|
||||
{
|
||||
if (slot == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(slot));
|
||||
}
|
||||
|
||||
Debug.Assert(slot.Data != null);
|
||||
return slot.Data;
|
||||
}
|
||||
|
||||
public static object GetData(LocalDataStoreSlot slot)
|
||||
{
|
||||
return GetThreadLocal(slot).Value;
|
||||
}
|
||||
|
||||
public static void SetData(LocalDataStoreSlot slot, object value)
|
||||
{
|
||||
GetThreadLocal(slot).Value = value;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
27
external/corefx/src/System.Threading.Thread/src/System/Threading/ThreadAbortException.cs
vendored
Normal file
27
external/corefx/src/System.Threading.Thread/src/System/Threading/ThreadAbortException.cs
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
// 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.
|
||||
|
||||
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
|
||||
[Serializable]
|
||||
#if !NETNATIVE
|
||||
public sealed class ThreadAbortException : SystemException
|
||||
#else
|
||||
public sealed class ThreadAbortException : Exception
|
||||
#endif
|
||||
{
|
||||
private ThreadAbortException()
|
||||
{
|
||||
}
|
||||
|
||||
private ThreadAbortException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
}
|
||||
|
||||
public object ExceptionState => null;
|
||||
}
|
||||
}
|
||||
26
external/corefx/src/System.Threading.Thread/src/System/Threading/ThreadExceptionEventArgs.cs
vendored
Normal file
26
external/corefx/src/System.Threading.Thread/src/System/Threading/ThreadExceptionEventArgs.cs
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// 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.Threading
|
||||
{
|
||||
public class ThreadExceptionEventArgs : EventArgs
|
||||
{
|
||||
private Exception m_exception;
|
||||
|
||||
public ThreadExceptionEventArgs(Exception t)
|
||||
{
|
||||
m_exception = t;
|
||||
}
|
||||
|
||||
public Exception Exception
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_exception;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void ThreadExceptionEventHandler(object sender, ThreadExceptionEventArgs e);
|
||||
}
|
||||
69
external/corefx/src/System.Threading.Thread/tests/CompressedStackTests.cs
vendored
Normal file
69
external/corefx/src/System.Threading.Thread/tests/CompressedStackTests.cs
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
// 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.
|
||||
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using Xunit;
|
||||
|
||||
namespace System.Threading.Tests
|
||||
{
|
||||
public static class CompressedStackTests
|
||||
{
|
||||
[Fact]
|
||||
public static void Capture_GetCompressedStack_CreateCopy_Test()
|
||||
{
|
||||
CompressedStack compressedStack = CompressedStack.Capture();
|
||||
Assert.NotNull(compressedStack);
|
||||
Assert.NotNull(compressedStack.CreateCopy());
|
||||
Assert.NotNull(CompressedStack.GetCompressedStack());
|
||||
Assert.NotNull(CompressedStack.GetCompressedStack().CreateCopy());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] // desktop framework throws ArgumentException
|
||||
public static void RunTest_SkipOnDesktopFramework()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() => CompressedStack.Run(null, state => { }, null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void RunTest()
|
||||
{
|
||||
CompressedStack compressedStack = CompressedStack.Capture();
|
||||
Assert.Throws<NullReferenceException>(() => CompressedStack.Run(compressedStack, null, null));
|
||||
|
||||
var obj = new object();
|
||||
Thread mainThread = Thread.CurrentThread;
|
||||
bool callbackRan = false;
|
||||
CompressedStack.Run(
|
||||
compressedStack,
|
||||
state =>
|
||||
{
|
||||
Assert.Same(obj, state);
|
||||
Assert.Same(mainThread, Thread.CurrentThread);
|
||||
callbackRan = true;
|
||||
},
|
||||
obj);
|
||||
Assert.True(callbackRan);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void SerializationTest()
|
||||
{
|
||||
CompressedStack compressedStack = CompressedStack.Capture();
|
||||
Assert.Throws<ArgumentNullException>(() => compressedStack.GetObjectData(null, new StreamingContext()));
|
||||
|
||||
var binaryFormatter = new BinaryFormatter();
|
||||
var memoryStream = new MemoryStream();
|
||||
binaryFormatter.Serialize(memoryStream, compressedStack);
|
||||
memoryStream.Close();
|
||||
byte[] binaryData = memoryStream.ToArray();
|
||||
|
||||
memoryStream = new MemoryStream(binaryData);
|
||||
compressedStack = (CompressedStack)binaryFormatter.Deserialize(memoryStream);
|
||||
memoryStream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
8
external/corefx/src/System.Threading.Thread/tests/Configurations.props
vendored
Normal file
8
external/corefx/src/System.Threading.Thread/tests/Configurations.props
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
netstandard;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
59
external/corefx/src/System.Threading.Thread/tests/ExceptionTests.cs
vendored
Normal file
59
external/corefx/src/System.Threading.Thread/tests/ExceptionTests.cs
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
// 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.
|
||||
|
||||
using Xunit;
|
||||
|
||||
namespace System.Threading.Threads.Tests
|
||||
{
|
||||
public static class ExceptionTests
|
||||
{
|
||||
private const int ThreadInterruptedException_HResult = unchecked((int)0x80131519);
|
||||
private const int ThreadStateException_HResult = unchecked((int)0x80131520);
|
||||
|
||||
private static void ConstructorTest<T>(
|
||||
int expectedHResult,
|
||||
Func<T> createDefault,
|
||||
Func<string, T> createWithMessage,
|
||||
Func<string, Exception, T> createWithMessageAndException)
|
||||
where T : Exception
|
||||
{
|
||||
var ex = createDefault();
|
||||
Assert.False(string.IsNullOrEmpty(ex.Message));
|
||||
Assert.Null(ex.InnerException);
|
||||
Assert.Equal(expectedHResult, ex.HResult);
|
||||
|
||||
var message = "foo";
|
||||
ex = createWithMessage(message);
|
||||
Assert.Equal(message, ex.Message);
|
||||
Assert.Null(ex.InnerException);
|
||||
Assert.Equal(expectedHResult, ex.HResult);
|
||||
|
||||
var innerException = new Exception();
|
||||
ex = createWithMessageAndException(message, innerException);
|
||||
Assert.Equal(message, ex.Message);
|
||||
Assert.Equal(innerException, ex.InnerException);
|
||||
Assert.Equal(expectedHResult, ex.HResult);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void ThreadInterruptedException_ConstructorTest()
|
||||
{
|
||||
ConstructorTest<ThreadInterruptedException>(
|
||||
ThreadInterruptedException_HResult,
|
||||
() => new ThreadInterruptedException(),
|
||||
message => new ThreadInterruptedException(message),
|
||||
(message, innerException) => new ThreadInterruptedException(message, innerException));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void ThreadStateException_ConstructorTest()
|
||||
{
|
||||
ConstructorTest<ThreadStateException>(
|
||||
ThreadStateException_HResult,
|
||||
() => new ThreadStateException(),
|
||||
message => new ThreadStateException(message),
|
||||
(message, innerException) => new ThreadStateException(message, innerException));
|
||||
}
|
||||
}
|
||||
}
|
||||
12
external/corefx/src/System.Threading.Thread/tests/System.Threading.Thread.Tests.builds
vendored
Normal file
12
external/corefx/src/System.Threading.Thread/tests/System.Threading.Thread.Tests.builds
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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>
|
||||
25
external/corefx/src/System.Threading.Thread/tests/System.Threading.Thread.Tests.csproj
vendored
Normal file
25
external/corefx/src/System.Threading.Thread/tests/System.Threading.Thread.Tests.csproj
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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" />
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{33F5A50E-B823-4FDD-8571-365C909ACEAE}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<!-- Default configurations to help VS understand the configurations -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="CompressedStackTests.cs" />
|
||||
<Compile Include="ExceptionTests.cs" />
|
||||
<Compile Include="ThreadExceptionEventArgsTests.cs" />
|
||||
<Compile Include="ThreadTests.netstandard.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(CommonTestPath)\System\Threading\ThreadTestHelpers.cs">
|
||||
<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>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user