Programming Applications for Microsoft Windows (Microsoft Programming Series)
The following chart summarizes how the various kernel objects behave with respect to thread synchronization.
| Object | When Nonsignaled | When Signaled | Successful Wait Side Effect |
|---|---|---|---|
| Process | While process is still active | When process terminates (ExitProcess, TerminateProcess) | None |
| Thread | While thread is still active | When thread terminates (ExitThread, TerminateThread) | None |
| Job | When job's time has not expired | When job time expires | None |
| File | When I/O request is pending | When I/O request completes | None |
| Console input | No input exists | When input is available | None |
| File change notifications | No files have changed | When file system detects changes | Resets notification |
| Auto-reset event | ResetEvent, PulseEvent, or successful wait | When SetEvent/PulseEvent is called | Resets event |
| Manual-reset event | ResetEvent or PulseEvent | When SetEvent/PulseEvent is called | None |
| Auto-reset waitable timer | CancelWaitableTimer or successful wait | When time comes due (SetWaitableTimer) | Resets timer |
| Manual-reset waitable timer | CancelWaitableTimer | When time comes due (SetWaitableTimer) | None |
| Semaphore | Successful wait | When count > 0 (ReleaseSemaphore) | Decrements count by 1 |
| Mutex | Successful wait | When unowned by a thread (ReleaseMutex) | Gives ownership to thread |
| Critical section (user-mode) | Successful wait ((Try)EnterCriticalSection) | When unowned by a thread (LeaveCriticalSection) | Gives ownership to thread |
Interlocked (user-mode) functions never cause a thread to be unschedulable; they alter a value and return immediately.