Thread names in logs and deadlock debug tools
This is a backport of PR15849 (Thread names in logs and deadlock debug tools).
See original PR for benchmarks.
Also includes some smaller follow-up PR's:
- PR15968 - Fix portability issue with pthreads
- PR16984 - util: Make thread names shorter
- PR17038 - Don't rename main thread at process level
Test plan
New tests: ninja check
Run with -logthreadnames
, observe lines are prefixed with thread
2020-10-28T11:39:16Z [init] init message: Done loading
2020-10-28T11:39:16Z [opencon] opencon thread start
2020-10-28T11:39:16Z [dnsseed] 0 addresses found from DNS seeds
2020-10-28T11:39:16Z [msghand] msghand thread start
2020-10-28T11:39:16Z [dnsseed] dnsseed thread exit
Compile with lockorder debugging enabled: cmake -GNinja -DCMAKE_BUILD_TYPE=Debug ..
Edited by Dagur Valberg Johannsson