Cleanup and resynchronize Thread/InternalThread fields. (mono/mono#15910)
authorJay Krell <jaykrell@microsoft.com>
Wed, 31 Jul 2019 16:30:50 +0000 (09:30 -0700)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Wed, 31 Jul 2019 16:30:50 +0000 (18:30 +0200)
- Remove unused.
- Add missing that just happened to work.
- Synchronize size between netcore and regular. `#if` considered bad.

Extracted from https://github.com/mono/mono/pull/15859.

Commit migrated from https://github.com/mono/mono/commit/499a02d6a14edb90263023a452df439f5ab5bd05

src/mono/configure.ac
src/mono/mono/metadata/object-internals.h
src/mono/netcore/System.Private.CoreLib/src/System.Threading/Thread.cs

index 4bfba8a..f9bd258 100644 (file)
@@ -62,7 +62,7 @@ MONO_VERSION_BUILD=`echo $VERSION | cut -d . -f 3`
 # This line is parsed by tools besides autoconf, such as msvc/mono.winconfig.targets.
 # It should remain in the format they expect.
 #
-MONO_CORLIB_VERSION=21aeaa06-293b-4279-82ce-2a32285a3ea3
+MONO_CORLIB_VERSION=ddb2b1db-a7eb-4786-bab3-fd15de35671c
 
 #
 # Put a quoted #define in config.h.
index 626d060..cb652c2 100644 (file)
@@ -564,11 +564,11 @@ struct _MonoThread {
 #else
 struct _MonoInternalThread {
 #endif
+       // FIXME: Mechanize keeping this in sync with managed.
        MonoObject  obj;
        volatile int lock_thread_id; /* to be used as the pre-shifted thread id in thin locks. Used for appdomain_ref push/pop */
        MonoThreadHandle *handle;
        gpointer native_handle;
-       gpointer unused3;
        gunichar2  *name;
        guint32     name_len;
        guint32     state;      /* must be accessed while longlived->synch_cs is locked */
@@ -597,7 +597,6 @@ struct _MonoInternalThread {
        gint32 managed_id;
        guint32 small_id;
        MonoThreadManageCallback manage_callback;
-       gpointer unused4;
        gsize    flags;
        gpointer thread_pinning_ref;
        gsize __abort_protected_block_count;
@@ -605,20 +604,14 @@ struct _MonoInternalThread {
        GPtrArray *owned_mutexes;
        MonoOSEvent *suspended;
        gint32 self_suspended; // TRUE | FALSE
-
        gsize thread_state;
+
 #ifdef ENABLE_NETCORE
        struct _MonoThread *internal_thread;
        MonoObject *start_obj;
        MonoException *pending_exception;
 #else
-       /* 
-        * These fields are used to avoid having to increment corlib versions
-        * when a new field is added to this structure.
-        * Please synchronize any changes with InternalThread in Thread.cs, i.e. add the
-        * same field there.
-        */
-       gsize unused2;
+       void* unused [3]; // same size as netcore
 #endif
        /* This is used only to check that we are in sync between the representation
         * of MonoInternalThread in native and InternalThread in managed
index cfd9827..41bce71 100644 (file)
@@ -20,7 +20,6 @@ namespace System.Threading
                // stores a thread handle
                IntPtr handle;
                IntPtr native_handle; // used only on Win32
-               IntPtr unused3;
                /* accessed only from unmanaged code */
                private IntPtr name;
                private int name_len;
@@ -50,7 +49,6 @@ namespace System.Threading
                internal int managed_id;
                private int small_id;
                private IntPtr manage_callback;
-               private IntPtr unused4;
                private IntPtr flags;
                private IntPtr thread_pinning_ref;
                private IntPtr abort_protected_block_count;
@@ -59,6 +57,7 @@ namespace System.Threading
                private IntPtr suspended_event;
                private int self_suspended;
                private IntPtr thread_state;
+
                private Thread self;
                private object pending_exception;
                private object start_obj;