Thread Scheduling

The Windows CE thread scheduler is responsible for ensuring that threads get the proper amount of time to execute their code. Each thread is given a "quantum" of time in which to execute code. Once the quantum of time has elapsed, the thread scheduler allows another thread to execute for its quantum. In Windows CE versions prior to 3.0, the quantum was set at 25 milliseconds. In Windows CE 3.0 it is set to 100 milliseconds (although this figure can be changed by an OEM). This means that in Windows CE 3.0 a thread can execute for up to 100 milliseconds without interruption.

A thread can change its quantum to make it longer or shorter. The code in Listing 5.10 displays the current quantum time for the thread using CeGetThreadQuantum ...

Get Windows® CE 3.0 Application Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.