Step Into C · Lesson 28 · Win32 in Depth
Threads & Synchronization
CreateThread, waiting and exit codes, data races, Interlocked operations, critical sections and events.
- ~45 minreading and coding
- 5missions
- membersaccess
- Win32real Windows API
Part of Step Into C. The full lesson, its missions and the real compiler and debugger are in the course. Try a free lesson first to see how it works.
WaitForMultipleObjects(n, handles, TRUE, INFINITE) waits for up to 64 handles at once; GetExitCodeThread reads what the function returned. All threads share the process's memory: globals, the heap, and anything you pass by pointer.
In this lesson
- A thread is a function running on its own
- The data race
- Events: "go" signals between threads
Missions
- Four workers
- Exit codes
- Lose no updates
- A critical section
- Signal with an event