I have code similar to the following code
boost::thread myThread
unsigned char readbuffer[bignumber];
unsigned char writebuffer[bignumber];
for(int i=0; i&l
First, I wasn't explicitly killing off my threads with thread.join() or thread.detach() so the total number of threads would grow out of control and throw an exception.
Also, in my inner loop I was creating two threads but keeping only one handle. So I lost control of 1 thread each iteration of the outer loop causing the total number of threads to grow past the prescribed limit of threads causing the exception.
To retain unique handles to the threads created in the inner loop I added them into a boost::group and used a myGroup.join_all(). I suppose I also could have used a vector to push the handles onto and then popped them off to join them all.
boost::thread_group myThreadGroup
unsigned char readbuffer[bignumber];
unsigned char writebuffer[bignumber];
for(int i=0; i