
5 Jun
2010
5 Jun
'10
5:22 p.m.
Therefore, if you want an array of threads, you need to allocate each thread object individually on the heap, like:
boost::thread* thr[SIZE]; for (int i = 0; i < SIZE; ++i) thr[i] = new boost::thread(functor);
Then of course, you need to iterate through the array later and call delete on each thread object.
Consider using thread_group: http://www.boost.org/doc/libs/1_43_0/doc/html/thread/thread_management.html#...