我需要知道当前线程的身份,以跟踪哪些线程正在对共享数据结构发出某些请求。
You can use boost::this_thread::get_id()
to get a boost::thread::id
representing the thread.
I don't think you can get a pointer to a boost::thread
object, because the thread doesn't necessarily have one attached. And it cannot make one because it might have one attached.
没办法,但是您可以支持成对的hashmap:thread-id线程。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.