Chapter 8. Thread Synchronization

Threads can simplify program design and implementation and also improve performance, but thread usage requires care to ensure that shared resources are protected against simultaneous modification and that threads run only when appropriate. This chapter shows how to use Windows synchronization objects—CRITICAL_SECTIONs, mutexes, semaphores, and events1—to solve these problems and describes some of the problems, such as deadlocks and race conditions, that can occur with improper synchronization object use. Some synchronization objects can be used to synchronize threads in the same process or in separate processes.

1 The last three are Windows kernel objects referenced with HANDLEs. The first is not a kernel object. ...

Get Windows System Programming, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.