All Forums
 Microsoft Windows CE
 General CE
 Threads and priorities
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Author Topic  

rbhalla

13 Posts

Posted - 04 Jun 2002 :  15:12:53  Show Profile  Email Poster
How do I create a Thread with a high (or highest) priority.
Thanks in advance

ctacke

877 Posts

Posted - 04 Jun 2002 :  15:20:11  Show Profile  Email Poster
You can affect the thread priority using the CeSetThreadPriority() API. The priority can range from 0 to 255, with 0 being the highest priority.

Additionally, you can adjust the thread quantum (default timeslice) using the CeSetThreadQuantum() API. The default quantum is 100 ms.


HANDLE hThread = CreateThread(NULL, NULL, MyFunc, NULL, 0);

CeSetThreadPriority(hThread, 0); // highest priority
CeSetThreadQuantum(hThread, 10); // 10ms quantum


I'd like to add a note of caution as well. Adjusting thread priority and/or quantum can have adverse performance effects on other processes and if the thread code is not clean, it can have an adverse effect on the entire OS.

-----------------
Chris Tacke, eMVP
Applied Data Support
Go to Top of Page
  Topic  
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Jump To:
Eurotech Support Forums © Eurotech Inc. Go To Top Of Page
This page was generated in 0.02 seconds. Snitz Forums 2000