google / glog

C++ implementation of the Google logging module
http://google.github.io/glog/
BSD 3-Clause "New" or "Revised" License
6.93k stars 2.05k forks source link

Why change to using cpp standard thread id instead of native os thread id? #1112

Open kuntryn opened 2 weeks ago

kuntryn commented 2 weeks ago

https://github.com/google/glog/pull/1019 The thread id in log was changed to using cpp standard thread id starting from version 0.7.0. However, because the thread id of the standard library cannot be mapped to thread id of the operating system easily, it is less helpful when debugging, especially when used in combination with commands such as ps and top.

sergiud commented 2 weeks ago

As we switched to C++14 the goal was to eliminate platform specific boilerplate code. While your use case is probably valid, most of the users will be using standard threads which is the only well-defined approach to concurrency in C++. Also, with debuggers it is straightforward to identify the corresponding thread without any conversion.