Answer the question
In order to leave comments, you need to log in
How to get thread id in C++ process?
How to get id and handles of all threads running only in C++ code? That is, only those threads that were created during the execution of the program.
Answer the question
In order to leave comments, you need to log in
It is possible to get a list of all threads of one process via Thread32First/Thread32Next ( example ).
It is looked for in Google literally on "winapi list threads".
If you create them, then the easiest way is to remember what you created there.
For example:
for std::thread there is std::thread::id get_id() const noexcept
for CreateThread - the last parameter is a pointer where to add id
for pthread_create - the first parameter is a pointer to pthread_t where id will be added on success
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question