See #34064
We need a check in mono_native_thread_set_name on Linux that the tid does not represent the main thread of the program (in the sense that on Linux gettid () == getpid () for the main thread).
The problem is that mono_native_thread_set_name gets a MonoNativeThreadId (which is pthread_t on Linux) and we need to compare that to the OS thread id of the main thread (which is a pid_t - gettid () of the main thread is the same as getpid()).
We have mono_native_thread_os_id_get () but it only returns the pid_t of the current thread - not of an arbitrary MonoNativeThreadId.
So we need some mechanism to go from a MonoNativeThreadId (or maybe a MonoThreadInfo) to a native OS thread id.
See #34064
We need a check in
mono_native_thread_set_nameon Linux that thetiddoes not represent the main thread of the program (in the sense that on Linuxgettid () == getpid ()for the main thread).The problem is that
mono_native_thread_set_namegets aMonoNativeThreadId(which ispthread_ton Linux) and we need to compare that to the OS thread id of the main thread (which is apid_t-gettid ()of the main thread is the same asgetpid()).We have
mono_native_thread_os_id_get ()but it only returns thepid_tof the current thread - not of an arbitraryMonoNativeThreadId.So we need some mechanism to go from a
MonoNativeThreadId(or maybe aMonoThreadInfo) to a native OS thread id.