Boost logo

Boost Users :

Subject: Re: [Boost-users] Using boost::thread to keep all cores busy
From: James C. Sutherland (James.Sutherland_at_[hidden])
Date: 2010-07-26 13:10:38


On Mon, Jul 26, 2010 at 8:41 AM, Eric J. Holtman <eric_at_[hidden]> wrote:

> On 7/26/2010 9:37 AM, Internet Retard wrote:
>
>
>
> All at once? What if I have millions of tasks rather than a few? I want to
> be working on 2 tasks all the time. If my queue is not empty, then as a
> thread ends, it sees there are more tasks in the queue and gets one.
>
>
> You only launch *two* tasks. They keep going back to the
> queue to get new work when they finished their current item.
>
>
You might want to look at the threadpool project:
  http://threadpool.sourceforge.net/
This is built on boost::thread and has a very nice implementation for
queuing work for threads. It has various types of queues (priority, fifo,
etc).



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