On Thu, Jun 9, 2011 at 11:21 PM, Christoph Heindl
On Fri, Jun 10, 2011 at 3:13 AM, Brad
wrote: 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#... _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
I'm not sure if this was also part of the question, but even if not, I'm also curious: Is there a boost-ey way of setting the affinity so that the threads are pinned to physical cores? I have my own wrappers at the moment, but I'd love to use something from boost, if available. Thanks, Brian