Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
In an OS on which several threads run concurrently, it is important to be able to synchronize the activities of various threads.
Windows Mobile provides several synchronization objects that enable you to synchronize a thread's actions with those of another thread. These objects include critical sections, mutexes, events, and semaphores. Each object type, such as memory maps, semaphores, events, message queues, mutexes, and watchdog timers, has its own namespace. Empty strings ("") are handled as named objects. On Windows desktop-based platforms, synchronization objects all share the same namespace.
You can also use interlocked functions to synchronize a thread.
Regardless of the synchronization method that you use, a thread synchronizes itself with another thread by releasing a synchronization object, and then entering a waiting state.
The synchronization object tells the OS what special event must occur before the thread can resume running. When that event occurs, the thread can again be scheduled for CPU time. After it is scheduled, the thread continues running. The thread is now synchronized with the event.