Latelly I\'ve been working with multi-thread coding, after a while writing I realized that if I used std::cout in different boost::threads, the output would came without a l
Give each thread a std::ostringstream to write output to. At the end of the program, print each thread's output in order.
std::ostringstream
How else would you do it, considering that thread 4 may finish long before thread 1?