ThreadPriority to a asynchronous call

Hi!

Is there any way to assing a thread priority to a asynchronous call

Now, i'm using in the target method:

Thread.CurrentThread.Priority = ThreadPriority.Lowest;

But i don't like this way.

Regards.




Answer this question

ThreadPriority to a asynchronous call

  • Terry Showers

    Lowest was only like a example, to avoid Normal.

    I'm looking for a elegant way like "MyThread.Priority=ThreadPriority.Normal" , but if is the only way ... is the only way, thanks:D

    Regards.


  • Tigerroad

     
    Hi!

    Is there any way to assing a thread priority to a asynchronous call

    Now, i'm using in the target method:

    Thread.CurrentThread.Priority = ThreadPriority.Lowest;

    But i don't like this way.

    Regards.

    Why don't you like it   It's the only way to change the priority of a pool thread. Note that IMO it's a bad idea to change the thread priority to lowest, chances are that your thread will only wake when starved when there are plenty of runable threads at a higer priority, that is every ~5 seconds on XP. What's the rationale behind this
     
    Willy.
     
     
     

  • da_Codez

    nobody


  • ThreadPriority to a asynchronous call