Hi there,
I'm trying to find a way to let a number of threads start execution
simultaneously, and in any case not before a certain condition has come
true. I would also like to terminate them within a relatively short time
frame.
I can not use the Boost.Thread barrier class, as I do not know the number of
threads in advance (users register consumer-type objects, and I do not know
how many there will be). I also believe I do not have to use a condition
variable, as the different threads need to synchronize their access to a
data ressource anyway, and I can use the same mutex to block them in the
beginning.
I have thus come up with something like the code quoted below. Are there
easier ways to do this with the Boost.Thread library ?
One of the problems (which seems to be unrelated to the code below) is that
the three threads do not get called equally often. In one run, one thread
was called 14564 times, another 1607 times and the third one 8676 times.
Thanks and Best Regards,
Ruediger
/***********************************************************************/
#include <iostream>
#include