Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@ -49,7 +49,8 @@ namespace System.Threading {
#region Sync with metadata/object-internals.h
int lock_thread_id;
// stores a thread handle
internal IntPtr system_thread_handle;
IntPtr handle;
IntPtr native_handle; // used only on Win32
/* Note this is an opaque object (an array), not a CultureInfo */
private object cached_culture_info;
@ -90,6 +91,10 @@ namespace System.Threading {
private IntPtr flags;
private IntPtr thread_pinning_ref;
private IntPtr abort_protected_block_count;
private int priority = (int) ThreadPriority.Normal;
private IntPtr owned_mutex;
private IntPtr suspended_event;
private int self_suspended;
/*
* These fields are used to avoid having to increment corlib versions
* when a new field is added to the unmanaged MonoThread structure.
@ -107,11 +112,11 @@ namespace System.Threading {
// Closes the system thread handle
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern void Thread_free_internal(IntPtr handle);
private extern void Thread_free_internal();
[ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
~InternalThread() {
Thread_free_internal(system_thread_handle);
Thread_free_internal();
}
}
@ -122,7 +127,6 @@ namespace System.Threading {
private InternalThread internal_thread;
object m_ThreadStartArg;
object pending_exception;
int priority = (int) ThreadPriority.Normal;
#endregion
#pragma warning restore 414
@ -284,17 +288,17 @@ namespace System.Threading {
}
}
// Looks up the object associated with the current thread
// this is called by the JIT directly, too
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static InternalThread CurrentInternalThread_internal();
private extern static Thread GetCurrentThread ();
public static Thread CurrentThread {
[ReliabilityContract (Consistency.WillNotCorruptState, Cer.MayFail)]
get {
if (current_thread == null)
current_thread = new Thread (CurrentInternalThread_internal ());
return current_thread;
Thread current = current_thread;
if (current != null)
return current;
// This will set the current_thread tls variable
return GetCurrentThread ();
}
}