Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
This std::thread examples demonstrates how to use std::mutexes to share std::cout nicely, as in the previous example, std::thread example 1: two counting threads, the output to std::cout was messy.
#include <iostream> |
Screen output:
#2: 10 |
This example is checked for errors in helgrind example 2: two counting threads using std::mutex, where helgrind is shown to detect no errors.
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.