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

Understanding the .NET synchronization essentials

After basic thread operations such as starting the thread or task and providing its start address, .NET also provides synchronization mechanisms. These mechanisms are important in order to understand the proper use of threads for concurrent operations without interfering with threads. Furthermore, we will explain blocking methods, locking, signaling, and non-blocking synchronization.

In .NET, the blocking methods are Thread::Sleep, Thread::Join, and Task::Wait. It is better to block the thread instead of spinning it and wasting processor time. When we say spin, we think of a loop where a thread will iterate the loop until some condition is satisfied. The Sleep method simply changes the thread state ...

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