Synchronizing Processes and Threads

In an OS where several threads run concurrently, it is important to be able to synchronize the activities of various threads. Windows CE provides several synchronization objects that enable you to synchronize a thread's actions with those of another thread. These objects include: critical sections, mutexes, and events. Additionally, you can use interlocked functions to synchronize a thread.

Regardless of the synchronization method that is used, a thread synchronizes itself with another thread by releasing a synchronization object and then entering a wait state. The synchronization object tells the OS what special event has to occur before the thread can resume execution. When the event occurs, the thread is again eligible to be scheduled for CPU time. Once it is scheduled, the thread continues executing. The thread has now synchronized its execution with the occurrence of the event.