|
Boost Users : |
Subject: Re: [Boost-users] [Threads] How to keep number of running thread constant, performing different operations
From: Olaf Peter (ope-devel_at_[hidden])
Date: 2011-06-17 03:55:02
> I have different threads which have to work on completely different
> input and output data (non critical sections): an atomic operation per
> thread, each one with different time execution but everyone with an
> intense use of the CPU.
> Let's say I have 10 operations to perform (10 threads): I would like to
> run concurrently only 2 threads because of resource consumption.
>
> My problem is that when a threads ends its execution, I would like to
> suddenly start another thread performing operation 3, in order to have
> constantly 2 threads working, and so on until the end of operations.
>
> How can I achieve this? I thought to insert my threads into a
> vector...but I have no idea on how start and join them in order to
> obtain what described above.
Are you looking implicit for a thread_group?
http://www.boost.org/doc/libs/1_46_0/doc/html/thread/thread_management.html#thread.thread_management.threadgroup
Regards,
Olaf
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