Step Into Labs

Step Into C · Lesson 28 · Win32 in Depth

Threads & Synchronization

CreateThread, waiting and exit codes, data races, Interlocked operations, critical sections and events.

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

Missions

  1. Four workers
  2. Exit codes
  3. Lose no updates
  4. A critical section
  5. Signal with an event