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

Signaling with event wait handles

In the Understanding the .NET synchronization essentials recipe, we used an unsafe way to access the bContinue shared object, and we used the Sleep method to release the processor for one second while waiting for the user to make a choice between continuing and exiting the application. Later, in the Locking and avoiding deadlocks recipe, we've improved our application to be thread–safe by adding locks to ensure exclusive access—again with the Sleep method inside the loop. The Microsoft .NET framework provides signaling objects that are mostly similar to Event, which we have explained in the previous chapters. Those are the AutoResetEvent, ManualResetEvent, ManualResetEventSlim, CountDownEvent, Barrier, and Wait ...

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