Boost logo

Boost Users :

Subject: Re: [Boost-users] threads: shared lock question
From: Samvel Khalatyan (samvel.khalatyan_at_[hidden])
Date: 2011-09-19 10:12:15


Hi Mark,

You may use conditional variables in threads. Perform the calculation in
each thread, acquire lock and then wait for conditional variable to be
notified from the main thread. The above steps should be put into some loop.
I use this technique in my analysis:

loop example: http://goo.gl/mi6rr
conditional variable use: http://goo.gl/8BVKv
my condition class: http://goo.gl/sVS7y [separate repository]

Good Luck, Samvel

On Thu, Sep 15, 2011 at 11:50 PM, Mark Higgins <miggins_at_[hidden]> wrote:

> I'm new to threads and boost, so I'm sure this is a real newbie question
> and hopefully quite easy to answer!
>
> I'm trying to set up a pool of threads that do a calculation, and I want to
> wait for those calculations to finish. Normally I'd do
> thread_group.join_all() to wait for the threads to exit - but in this case I
> want my threads hanging around so that I can redo that calculation over and
> over again when I ask it to do.
>
> What's the best way to signal back to the main thread that all calculations
> are complete? Should I use a barrier?
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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