Книга: Microsoft Windows Embedded CE 6.0 Exam Preparation Kit
Events
Events
The Event object is another kernel object that synchronizes threads. This object enables applications to signal other threads when a task is finished or when data is available to potential readers. Each event has signaled/non-signaled state information used by the API to identify the state of the event. Two types of events, manual events and auto-reset events, are created according to the behavior expected by the event.
The creating thread specifies a name for the event object at creation time, although it is also possible to create an unnamed event. It is possible for threads in other processes to call CreateMutex and specify the same name, but these subsequent calls do not create new kernel objects.
Table 3-14 lists the most important functions for event objects for thread synchronization purposes.
Table 3-14 Event API
Function | Description |
---|---|
CreateEvent | Creates and initializes a named or unnamed event object. |
SetEvent | Signal an event (see below). |
PulseEvent | Pulse and signal the event (see below). |
ResetEvent | Reset a signaled event. |
WaitForSingleObject | Waits for an event to be signaled. |
WaitForMultipleObjects | Waits to be signaled by a single or multiple event objects. |
CloseHandle | Releases an Event object. |
The behavior of the events API is different according to the type of events. When you use SetEvent on a manual event object, the event will stay signaled until ResetEvent is explicitly called. Auto-reset events only stay signaled until a single waiting thread is released. At most, one waiting thread is released when using the PulseEvent function on auto-reset events before it immediately transitions back to the non-signaled state. In the case of manual threads, all waiting threads are released and immediately transition back to a non-signaled state.
- 15.3.1. Shared Library Events in GDB
- Chapter 7 Delegates and Events
- Handling Events
- Implementing Events
- Difference between Events and Delegates
- Testing Wdm3 Events
- 18.3. Архитектура Comet на основе стандарта «Server-Sent Events»
- EventSource
- Параметр сокета SCTP_EVENTS
- CHAPTER 16 Handling Activity Lifecycle Events
- Generating Events
- Глава 16 Стимулирование сбыта, спонсорство и маркетинг специальных событий (events)