Question

I am developing a rt driver for Win CE and to achieve my purpose I need to be able to change a thread's priority. However problem is that, I do not have the source code special thanks to Microsoft! Thus, I cannot set the thread's priority where it is created.

Currently what I know is the name of the thread (threadname) that I read from Visual Sudio's threads window. (pThread, hThread values always change therefore I cannot use them. Only static thing is threadname.) Can I assign a value to the thread by only knowing its name? (Can I find its unique thread ID by knowing its name?) I checked for built-in functions for threads, there exists a GetCurrentThread function which retrieves a pseudo handle for the calling thread. However, it is not suitable for me. Because in the future I cannot be sure that the current thread is the one that I want. Therefore I may set a different thread's priority.

To sum up: Is there a way to set a thread's priority by only knowin its thread name?

Regards,

Xentius

Was it helpful?

Solution

It seems that you can't guess the Thread Id with the name, but yo can try to use the CreateToolhelp32Snapshot function and you can list all threads or process, where you can guess the processid if you know the process name, then you could try to match the thread that belongs to this process. Good luck!

OTHER TIPS

According to this question and its answers, thread names don't actually exist outside the debugger.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top