-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bthread 使用的线程设置线程名 #1923
Comments
We must specify rules for the naming of threads. In my thinking, a thread' name can be "create_function + number". 我们必须要为创建的线程指定命名规则, 我的想法是, 一个线程的别名是 |
Worker threads and other threads has been named by #2136 . |
Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)
方便gdb && pstack 的时候找到bthread 使用线程
Describe the solution you'd like (描述你期望的解决方法)
pthread_setname_np
Describe alternatives you've considered (描述你想到的折衷方案)
在TaskControl::init, TaskControl::add_works
TimeThread::Start 创建线程时使用 pthread_setname_np 设置线程名
Additional context/screenshots (更多上下文/截图)
最近在查一个线程问题,bthread 因为使用了 pthread mutex 导致所有的bthread 都锁住了,pstack 也无法完整打出栈数据处理,无法快速识别出bthread 具体卡到哪了,如果为bthread 使用的线程命名,就比较方便的找出线程并用 gdb thread apply id bt 查看,线上进程有几个线程,最终花了较长时间才找到bthread 的线程并定位
The text was updated successfully, but these errors were encountered: