I want to implement an algorithm in c++ using two concurrent infinite loop:
the first infinite loop produces the upper bound on each iteration and the other infinite loop produces lower bound on each iteration. Both loops would terminate only when the the upper bound and lower bound meets.
What's the best way in c++98 (with boost thread) to achieve this? Thank you:)
Pseudo code (not sure if it is optimal):
main starts
create 2 thread
thread 1 runs INF_LOOP1(&lowerbound), which keeps updating the lower bound
thread 2 runs INF_LOOP2=(&upperbound), which updating the upper bound
every 10 seconds, check if lowerbound=upperbound, if yes, halt! if no, let the LOOP continue