Win32 synchronization objects and techniques

In order for the threads to be executed, they must be scheduled for execution. In order for them to be executed without interfering with each other, they must be synchronized.

Suppose that one thread creates a brush and then creates several threads that share the same brush and draw with it. The first thread must not destroy the brush until other threads have finished drawing. Or, for example, one thread accepts input from the user and writes it to a file, while another thread reads from the file and processes the text. The thread that reads can't read if a thread that writes is writing that file. Both situations require a means of coordination among several threads.

One solution would be to create a ...

Get C++ Multithreading Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.