O'Reilly logo

C++ Multithreading Cookbook by Milos Ljumovic

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required