[threads] Rename mono_thread_info_set_name () to mono_native_thread_set_name ().
authorAlex Rønne Petersen <alexrp@xamarin.com>
Fri, 8 Apr 2016 01:02:56 +0000 (03:02 +0200)
committerAlex Rønne Petersen <alexrp@xamarin.com>
Thu, 12 May 2016 12:12:18 +0000 (14:12 +0200)
This function has nothing to do with MonoThreadInfo structures, so the name is
somewhat misleading. It only requires a native thread ID.

mono/metadata/attach.c
mono/metadata/sgen-mono.c
mono/metadata/threads.c
mono/mini/driver.c
mono/mini/mini-posix.c
mono/profiler/proflog.c
mono/utils/mono-threads-posix.c
mono/utils/mono-threads-windows.c
mono/utils/mono-threads.c
mono/utils/mono-threads.h

index 5e1605fd972295a21362b31a4be27f3d4f7d61a7..9f6f1e6a836f794dca7bbc2ae4453786b1845f6c 100644 (file)
@@ -493,7 +493,7 @@ receiver_thread (void *arg)
        guint8 *p, *p_end;
        MonoObject *exc;
 
-       mono_thread_info_set_name (mono_native_thread_id_get (), "Attach receiver");
+       mono_native_thread_set_name (mono_native_thread_id_get (), "Attach receiver");
 
        printf ("attach: Listening on '%s'...\n", server_uri);
 
index 7e29d804156b0e64dd760868319245931a497a3d..6510bfe0f1ffc69f965bc211cdecd5725531eb03 100644 (file)
@@ -2284,7 +2284,7 @@ void
 sgen_client_thread_register_worker (void)
 {
        mono_thread_info_register_small_id ();
-       mono_thread_info_set_name (mono_native_thread_id_get (), "SGen worker");
+       mono_native_thread_set_name (mono_native_thread_id_get (), "SGen worker");
 }
 
 /* Variables holding start/end nursery so it won't have to be passed at every call */
index 3eff0768001f44bf538e13c1be48e3ed617c628a..2dea9feef71de19e65e2f18ead66c775e0ff8880 100644 (file)
@@ -730,7 +730,7 @@ static guint32 WINAPI start_wrapper_internal(void *data)
        if (internal->name && (internal->flags & MONO_THREAD_FLAG_NAME_SET)) {
                char *tname = g_utf16_to_utf8 (internal->name, internal->name_len, NULL, NULL, NULL);
                mono_profiler_thread_name (internal->tid, tname);
-               mono_thread_info_set_name (MONO_UINT_TO_NATIVE_THREAD_ID (internal->tid), tname);
+               mono_native_thread_set_name (MONO_UINT_TO_NATIVE_THREAD_ID (internal->tid), tname);
                g_free (tname);
        }
        /* start_func is set only for unmanaged start functions */
@@ -1396,7 +1396,7 @@ mono_thread_set_name_internal (MonoInternalThread *this_obj, MonoString *name, g
        if (this_obj->name && this_obj->tid) {
                char *tname = mono_string_to_utf8 (name);
                mono_profiler_thread_name (this_obj->tid, tname);
-               mono_thread_info_set_name (thread_get_tid (this_obj), tname);
+               mono_native_thread_set_name (thread_get_tid (this_obj), tname);
                mono_free (tname);
        }
 }
index 452eaedf706b9d9165f9189fc6d787b54ff5e316..3c4b3c65a1fc37b6182b013e80fa4bd7868cb8ab 100644 (file)
@@ -1990,7 +1990,7 @@ mono_main (int argc, char* argv[])
         * We only set the native name of the thread since MS.NET leaves the
         * managed thread name for the main thread as null.
         */
-       mono_thread_info_set_name (mono_native_thread_id_get (), "Main");
+       mono_native_thread_set_name (mono_native_thread_id_get (), "Main");
 
        if (enable_profile) {
                mono_profiler_load (profile_options);
index 95b45b56afb55485e6fef0845395d5e4638f6177..870a5b584a8ae903d480f13873879097e6751600 100644 (file)
@@ -704,7 +704,7 @@ static mono_native_thread_return_t
 sampling_thread_func (void *data)
 {
        mono_threads_attach_tools_thread ();
-       mono_thread_info_set_name (mono_native_thread_id_get (), "Profiler sampler");
+       mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler sampler");
 
        gint64 rate = 1000000000 / mono_profiler_get_sampling_rate ();
 
index 23605903f4350f01b1a6c982b077a56648aae204..dfd801d8ae18e18159c9c4bc4b648515a3b59bd3 100644 (file)
@@ -4020,7 +4020,7 @@ helper_thread (void* arg)
        MonoThread *thread = NULL;
 
        mono_threads_attach_tools_thread ();
-       mono_thread_info_set_name (mono_native_thread_id_get (), "Profiler helper");
+       mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler helper");
 
        //fprintf (stderr, "Server listening\n");
        command_socket = -1;
@@ -4275,7 +4275,7 @@ writer_thread (void *arg)
        MonoProfiler *prof = (MonoProfiler *)arg;
 
        mono_threads_attach_tools_thread ();
-       mono_thread_info_set_name (mono_native_thread_id_get (), "Profiler writer");
+       mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler writer");
 
        dump_header (prof);
 
@@ -4386,7 +4386,7 @@ dumper_thread (void *arg)
        MonoProfiler *prof = (MonoProfiler *)arg;
 
        mono_threads_attach_tools_thread ();
-       mono_thread_info_set_name (mono_native_thread_id_get (), "Profiler dumper");
+       mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler dumper");
 
        while (InterlockedRead (&prof->run_dumper_thread)) {
                mono_os_sem_wait (&prof->dumper_queue_sem, MONO_SEM_FLAGS_NONE);
index 395fdb5bdab19dacdf2de564c7e8fa534cd9b936..0111d5fd9086a939033748796442d08902d2a8d6 100644 (file)
@@ -277,7 +277,7 @@ mono_native_thread_create (MonoNativeThreadId *tid, gpointer func, gpointer arg)
 }
 
 void
-mono_threads_core_set_name (MonoNativeThreadId tid, const char *name)
+mono_native_thread_set_name (MonoNativeThreadId tid, const char *name)
 {
 #ifdef __MACH__
        /*
index b5dfb5dc2e3a7d58f3a92248725551b13816a4b7..2ec53e35bc2380a018e381b7c459a5198593285c 100644 (file)
@@ -344,7 +344,7 @@ typedef struct tagTHREADNAME_INFO
 #endif
 
 void
-mono_threads_core_set_name (MonoNativeThreadId tid, const char *name)
+mono_native_thread_set_name (MonoNativeThreadId tid, const char *name)
 {
 #if defined(_MSC_VER)
        /* http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx */
index f38a1afdbdd02ce3a3cc1eb479cec79d2b5a4e03..210ad965dd1000c37a1bb08721879b5cee1cf9d5 100644 (file)
@@ -1310,12 +1310,6 @@ mono_threads_open_thread_handle (HANDLE handle, MonoNativeThreadId tid)
        return mono_threads_core_open_thread_handle (handle, tid);
 }
 
-void
-mono_thread_info_set_name (MonoNativeThreadId tid, const char *name)
-{
-       mono_threads_core_set_name (tid, name);
-}
-
 #define INTERRUPT_STATE ((MonoThreadInfoInterruptToken*) (size_t) -1)
 
 struct _MonoThreadInfoInterruptToken {
index 0bf4bdfb168e46662784f7e2104b1516f125cebe..845a31cc392eca22175979ea6f79c86356ee9930 100644 (file)
@@ -358,9 +358,6 @@ mono_thread_info_lookup (MonoNativeThreadId id);
 gboolean
 mono_thread_info_resume (MonoNativeThreadId tid);
 
-MONO_API void
-mono_thread_info_set_name (MonoNativeThreadId tid, const char *name);
-
 void
 mono_thread_info_safe_suspend_and_run (MonoNativeThreadId id, gboolean interrupt_kernel, MonoSuspendThreadCallback callback, gpointer user_data);
 
@@ -519,7 +516,6 @@ void mono_threads_core_exit (int exit_code);
 void mono_threads_core_unregister (THREAD_INFO_TYPE *info);
 HANDLE mono_threads_core_open_handle (void);
 HANDLE mono_threads_core_open_thread_handle (HANDLE handle, MonoNativeThreadId tid);
-void mono_threads_core_set_name (MonoNativeThreadId tid, const char *name);
 
 void mono_threads_coop_begin_global_suspend (void);
 void mono_threads_coop_end_global_suspend (void);
@@ -533,6 +529,9 @@ mono_native_thread_id_equals (MonoNativeThreadId id1, MonoNativeThreadId id2);
 gboolean
 mono_native_thread_create (MonoNativeThreadId *tid, gpointer func, gpointer arg);
 
+MONO_API void
+mono_native_thread_set_name (MonoNativeThreadId tid, const char *name);
+
 /*Mach specific internals */
 void mono_threads_init_dead_letter (void);
 void mono_threads_install_dead_letter (void);