10 Jun
2011
10 Jun
'11
6:21 a.m.
On Fri, Jun 10, 2011 at 3:13 AM, Brad
What's the proper way to start a boost thread for each hardware thread available? I can do this... but it is clunky and does not scale (especially when there are lots of cores):
const unsigned int hwt() { const unsigned int t = boost::thread::hardware_concurrency(); return t; }
try boost::thread_group [1] boost::thread_group tg; for (int i =0; i < hwt(); ++i) { tg.create_thread(...); } tg.join_all(); Best regards, Christoph [1] http://www.boost.org/doc/libs/1_42_0/doc/html/thread/thread_management.html#...