Current App Priority


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Current App Priority

  1. #1
    T10 Guest

    Current App Priority

    Hi,

    I want to change the priority of the application that running from its code.
    How do I set its priority to low. What I actually want to do is to tap
    wasted cpu cycles. I am planning on achieving this by demoting the priority
    of the application.

    How do I achieve this?

    Thanks
    Tariq





  2. #2
    Mattias Sjögren Guest

    Re: Current App Priority

    Tariq,

    >I want to change the priority of the application that running from its code.
    >How do I set its priority to low. What I actually want to do is to tap
    >wasted cpu cycles. I am planning on achieving this by demoting the priority
    >of the application.
    >
    >How do I achieve this?


    If you want to change the priority for the entire process, you do

    using System.Diagnostics;
    ....
    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Xxxx;


    If you only want to change the current thread, you can either change
    it with the System.Diagnostics.ProcessThread class, or

    using System.Threading;
    ....
    Thread.CurrentThread.Priority = ThreadPriority.Xxxx;


    (Replace the Xxxx with an actual enumeration member.)


    Mattias

    ===
    Mattias Sjögren (VB MVP)
    mattias @ mvps.org
    http://www.msjogren.net/dotnet/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center