views:

408

answers:

1

Hi, I'm using a third party dll that's creating an AboveNormal priority thread and I'm wondering it it's possible to change the thread's priority. The only thing I know about this thread its his name.

Process.GetCurrentProcess().Threads give me only the id of the thread, not the thread's name.

Thanks

A: 

I don't believe there's any way of getting at other managed threads (i.e. Thread objects) within normal code. A debugger API would doubtless let you get at it, but there's nothing in the normal framework.

ProcessThread does have the PriorityLevel property though... if you know that the thread has set itself to "above normal" could you perhaps detect it that way and reset it? Do you know of any other threads in your process which will be "above normal"? Could you take a snapshot of all the thread IDs in your process before you call into the third party code, and try to work out which one is the new one that way?

Jon Skeet
I could make some snapshots before and after starting that thread and get in this way the ProcessThread and by correlating it with the priority it gives me a greater change of actually finding the right one.
lucian