Retain thread names as UTF8 instead of only UTF16. (mono/mono#15945)
authorJay Krell <jaykrell@microsoft.com>
Thu, 15 Aug 2019 17:37:34 +0000 (10:37 -0700)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Thu, 15 Aug 2019 17:37:34 +0000 (19:37 +0200)
commit501e574c50addaf5b298fcfe0438aa72c2f1e98a
treea3aa6bfcecf03cfc107816640b78119aa0463776
parentdc72a9d0e4477dc1fa25263ec429b4ac6930a5c4
Retain thread names as UTF8 instead of only UTF16. (mono/mono#15945)

Windows can still have its Unicode thread names, since we have UTF16 initially, just don't retain it.

This does penalize ves_icall_System_Threading_Thread_GetName_internal (non-netcore only),
which has to convert back to UTF16 each time.

But seems like a net win overall.

There is also a little prep work here for constant thread names and some temporary measures as multiple changes head toward the same code.

Rename `mono_thread_set_name_internal` to `mono_thread_set_name`.
Close possible race conditions.

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

Commit migrated from https://github.com/mono/mono/commit/7b64f1cd005ef4f8e7f0aa5655debca2754b1755
15 files changed:
src/mono/configure.ac
src/mono/mono/metadata/appdomain.c
src/mono/mono/metadata/attach.c
src/mono/mono/metadata/gc.c
src/mono/mono/metadata/object-internals.h
src/mono/mono/metadata/threadpool-io.c
src/mono/mono/metadata/threadpool.c
src/mono/mono/metadata/threads-types.h
src/mono/mono/metadata/threads.c
src/mono/mono/mini/aot-compiler.c
src/mono/mono/mini/debugger-agent.c
src/mono/mono/mini/mini-posix.c
src/mono/mono/profiler/aot.c
src/mono/mono/profiler/log.c
src/mono/netcore/System.Private.CoreLib/src/System.Threading/Thread.cs