|
Boost Users : |
Subject: Re: [Boost-users] Create A Boost Thread for each HW Thread?
From: Christoph Heindl (christoph.heindl_at_[hidden])
Date: 2011-06-10 02:21:38
On Fri, Jun 10, 2011 at 3:13 AM, Brad <boost_at_[hidden]> 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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net