Saturday, 9 November 2013

Keyed Events

 Keyed Events:

Keyed Events are the final synchronization method which I will be discussing for now, they are undocumented by Microsoft, and therefore reserved for their own use. Keyed Events are like Event Synchronization dispatcher objects but with a special unique identifier called a Key.

Keyed Events can be either be Signaled or Non-Signaled states like other dispatcher objects, however, when a thread sets the object to the Signaled state, it is achieved by setting the Key associated with the Event Object, and then releasing the thread which was waiting upon the Key. The thread being released must be within the same process as the signaling with the Key.

Keyed Events often have a Critical Section associated with them, which uses the address of the address of the Key as the address of Critical Section. Only waiting threads (or waiters) within the same process are awakened, and only one thread is released at a time.

The NtWaitForKeyedEvent is used to wait upon a Keyed Event. 

When a Keyed Event needs to perform a wait itself, then it uses a Semaphore which can be found within the ETHREAD data structure with a KeyedWaitSemaphore field. 

The KeyedWaitChain field is used to store a doubly linked list of waiting threads for the Keyed Event.


Windows keyed events, critical sections, and new Vista synchronization features

No comments:

Post a Comment