views:

52

answers:

2

I need to know the identity of the current thread to keep track of which threads are making certain requests to a shared data structure.

A: 

No way, but you can support hashmap of pairs: thread-id thread.

Dewfy
+6  A: 

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.

GMan