Here is a simplified version of my problem.
There are N threads executing following 3 instructions in an infinite loop:
A -> B -> C -> A -> B -> C -> A -> B -> .......
I want that all threads execute instruction B concurrently i.e. execution of B by any thread should start only if all threads have reached B. So, if there is a thread that has executed B -> C -> A, it should wait here till other threads are also ready to execute B.
If possible, please let me know a portable solution that'll work on both windows & MAC.
You should check out the Boost thread library, especially the section about condition variables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With