I'm using boost::thread (which is in a next step using pthread) but would like to get the thread id / (lightweight) pid by the boost::thread pointer. I manage to do this with windows by using the member native_handle() but I couldn't find an alternative with linux.
boost::thread * boost_thread ptr = new boost::thread(/*...*/);
ptr->native_handle();
I've found a lot of posts about the current thread using something like pthread_self() but I'm no trying to get the thread id from inside this thread, I want to get it from the outside for the thread I just created using new boost::thread. Is there a way to retrieve the thread id/pid by using the native handle or something from the boost::thread structure?
Thank you very much!
EDIT: Not a duplicate cause the other thread doesn't solve this... at least not when getting the pthread_t from a boost::thread and thus having no influence upon it's creation. Or solved in a way like: not possible.