Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@ -406,12 +406,10 @@ namespace System.Threading {
ResetAbort_internal ();
}
#if NET_4_0
[HostProtectionAttribute (SecurityAction.LinkDemand, Synchronization = true, ExternalThreading = true)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
public extern static bool Yield ();
#endif
[MethodImplAttribute(MethodImplOptions.InternalCall)]
@ -587,11 +585,12 @@ namespace System.Threading {
public ThreadPriority Priority {
get {
return(ThreadPriority.Lowest);
return (ThreadPriority)GetPriority (Internal);
}
set {
// FIXME: Implement setter.
// FIXME: This doesn't do anything yet
SetPriority (Internal, (int)value);
}
}
@ -604,6 +603,12 @@ namespace System.Threading {
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static void Abort_internal (InternalThread thread, object stateInfo);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static int GetPriority (InternalThread thread);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static void SetPriority (InternalThread thread, int priority);
[SecurityPermission (SecurityAction.Demand, ControlThread=true)]
public void Abort ()
{
@ -869,6 +874,32 @@ namespace System.Threading {
}
}
internal bool HasExecutionContext {
get {
return _ec != null;
}
}
internal void BranchExecutionContext (out ExecutionContext.Switcher switcher)
{
if (_ec == null) {
switcher = new ExecutionContext.Switcher ();
} else {
switcher = new ExecutionContext.Switcher (_ec);
_ec.CopyOnWrite = true;
}
}
internal void RestoreExecutionContext (ref ExecutionContext.Switcher switcher)
{
if (switcher.IsEmpty) {
_ec = null;
return;
}
switcher.Restore (_ec);
}
public int ManagedThreadId {
[ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
get {