Give a name to a boost thread?

后端 未结 2 468
再見小時候
再見小時候 2020-12-08 16:24

Is it possible to give a name to a boost::thread so that the debuggers tables and the crash logs can be more readable? How?

2条回答
  •  無奈伤痛
    2020-12-08 17:05

    You would need to access the underlying thread primitive and assign a name in a system dependent manner. Debugging and crash logs are inherently system dependent and boost::thread is more about non-system-dependency, i.e. about portability.

    It seems ( http://www.boost.org/doc/libs/1_43_0/doc/html/thread.html ) that there is no documented way to access underlying system resources for a boost thread. (But I have never used it myself so I may miss something.)

    Edit: (As David writes in the comment) http://www.boost.org/doc/libs/1_43_0/doc/html/thread/thread_management.html#thread.thread_management.thread.nativehandle

提交回复
热议问题