I fixed some problems with the post about Boost threads. The example program worked correctly for the most part, but only by accident. I had incorrectly assumed that the join() method started the thread. This is not the case. It’s a method that blocks until the thread is done.

The correct solution would be to make a “barrier” which has one method, wait(). When a barrier is constructed, it is initalized with a counter. Each thread calls wait() when it’s done, decrementing the counter. When the counter reaches zero, all calls to wait() return. The example in the previous post about Boost threads now uses a barrier.

j j j