Condividi tramite


Synchronization

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

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.

See Also

Concepts

Scheduling
Critical Section Objects
Mutex Objects
Event Object Notification
Semaphore Objects
Wait Functions
Interlocked Functions
Interprocess Synchronization
Message Queue Point-to-Point