Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
This thread example investigates the program flow from two simultaneously running threads.
The code I implemented after the talk given by Hans Boehm [1].
Operating system(s) or programming environment(s)
Libraries used:
#------------------------------------------------- |
#include <algorithm> |
#!/bin/bash |
Screen output varies, so I used the script 'CppThreadExample3.sh' to let the program run a thousand times, so I could tally the output.
197x thread #1, x: 1, copy of y: 0, thread #2, y: 1, copy of x: 0, |
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.