thread names: coop, constants, usually ignore-error.
authorJay Krell <jaykrell@microsoft.com>
Thu, 25 Jul 2019 10:19:02 +0000 (03:19 -0700)
committerJay Krell <jaykrell@microsoft.com>
Fri, 16 Aug 2019 22:24:30 +0000 (15:24 -0700)
commit7cd5d236cb486d241a9408597587cae5676dbc4d
tree4df0d49db0be45d5abf165b64992e4b2c9d422a1
parent29a7e490fddd1fcea1d513a8b831c273b5585a79
thread names: coop, constants, usually ignore-error.

- Convert setting thread name to be coop-compatible.

- For constant thread names, just retain the constant, not a copy.
  This includes producing and using constant unicode thread names on Windows.

- Make setting a thread name often non-fatal, except where mandated by public API.

- From earlier PR: mono_free (mono-publib.c) would no longer be referenced and therefore
  no longer exported. That broke profilers and maybe other externals.
  Choices:
     1 Use it instead of g_free randomly sometimes.
     2 Call it randomly sometimes.
     3 include it in external-only.c or object.c
     4 Mark it external only (breaks profiler).
     5 Use a .def file or Unix equivalent.

     5 is best, 2 is done here, the advantages/disadvantages
     among most choices are subtle. 3 is probably better than 2
     but is slightly bigger change, to put off -- you'd stop
     compiling mono-publib.c and move it to include/extra_redist.

     The advantage of not-.def file is perhaps that it is exposed
     by the compiler, so maybe easy to port and work with.
     People are more comfortable with obscure C extensions than
     any linker options, and there are multiple linkers to contend
     with. Arguably there are fewer compilers.

Commit migrated from https://github.com/mono/mono/commit/0c6cb9fbc3f97e15acf6be07eb46c19a288b3937
17 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/icall-def-netcore.h
src/mono/mono/metadata/icall-def.h
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