问题描述
可以为 boost :: thread
命名一个名称,以便调试器表和崩溃日志可以更易读吗?如何?
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?
推荐答案
您需要访问底层线程原语并以系统依赖的方式分配名称。调试和崩溃日志本质上是系统依赖的,boost :: thread更多的是关于非系统依赖性,即关于可移植性。
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.
似乎()没有记录的方法来访问boost线程的底层系统资源。 (但我从来没有使用过它,所以我可能会错过某些东西。)
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.)
编辑:(正如David在评论中写道)
(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
这篇关于给一个boost线程的名字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!