I am trying to find if there is a better way to find all thread ids that belong to the current process. It looks like using CreateToolhelp32Snapshot with TH32CS_SNAPTHREAD and iterating over the threads to check if the thread's process id is equal to the current process id, is a solution but i want to avoid iterating all the running threads. I just want to iterate over the threads that belong to a given process. Please let me know if there is an API that is fast and simple. I need to do it in c++.
Thanks, Abhinay.
Performance Data Helper
(but you need to filter by the PID too ) or using theWin32_Thread
WMI Class filtering by theProcessHandle
property but the speed of the WMI in this case is not comparable to the WinAPI. So my advice is keep using the CreateToolhelp32Snapshot function. – Straightout