PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

using CeSetThreadPriority

Pejo Software - Per · 13 May 2002, 09:31 UTC
I have noticed that the demo application uses CeSetThreadPriority and sets the priority level of the rendering thread to zero. I would not reccomend doing that, or in fact I don't reccomend using CeSetThreadPriority at all. Use SetThreadPriority instead. Windows CE 3.0 has 255 priority levels that can be set with CeSetThreadPriority where 0 represents the highest priority. SetThreadPriority sets priority levels 248 to 255. Levels below are called real time levels and is used by the OS and drivers. You should not use those levels if you don't have a very good reason and know exactly what you are doing.
In Windows CE scheduling is done on thread basis and a thread will only run as long as there is no other thread with higher priority level that is scheduled to run. This makes it very easy to starve other threads. I have been working with driver/system development in Windows CE (not Pocket PC) for some OEMs and getting the priority levels right on different threads in the system is pretty tricky.
So what I wan't to say is: don't hijack the scheduling but let the OS do the scheduling unless you know exactly how it will affect the rest of the system.
Pejo Software - Per · 13 Jun 2002, 19:09 UTC
I noticed that the samples shipped with version 1.02 still uses CeSetThreadPriority.
Thanks for bumping. I'll remove the CeSetThreadPriority in 1.03 (which I intend to release on Sun/Mon with RLE-support added in).

/Johan
Harimwakairi · 01 Jul 2002, 06:37 UTC — *Oh* *my* *God*, thank you!
I just spent the last hour going nuts trying to figure out why the heck my view class wasn't getting all of its input messages from the OS. At first it wasn't getting any, but I put a call to Sleep() in between passes in the ThreadFunc, which helped but didn't fix the problem. It seemed like whenever the thread was buzzing, all input was going nowhere.

I replaced the ::CeSetThreadPriority call with one to ::SetThreadPriority and changed the level from zero to THREAD_PRIORITY_HIGHEST. Now everything's fine.

If it hadn't been for your out-of-the-blue post on this, I *never* would have known that's what was wrong. Thanks a million!
jul' · 02 Jul 2002, 10:49 UTC — Thanks too...
Changing the ThreadPriority helped me also !!!
I was trying to catch stylus click in my application, and it wasn't working very well... With the ThreadPriority change, now it works much more better !!!