How can you get the Linux thread Id of a std::thread()
问题 I was playing with std::thread and I was wondering how is it possible to get the thread id of a new std::thread() , I am not talking about std::thread::id but rather the OS Id given to the thread ( you can view it using pstree ). This is only for my knowledge, and it's targeted only to Linux platforms (no need to be portable). I can get the Linux Thread Id within the thread like this : #include <iostream> #include <thread> #include <unistd.h> #include <sys/syscall.h> #include <sys/types.h>