|
Boost Users : |
Subject: Re: [Boost-users] threads: shared lock question
From: Chris Cleeland (chris.cleeland_at_[hidden])
Date: 2011-09-19 11:13:43
On Mon, Sep 19, 2011 at 9:12 AM, Samvel Khalatyan
<samvel.khalatyan_at_[hidden]> wrote:
> 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]
You need to be careful with condition variables, as they typically
edge-triggered rather than level-triggered. If they are
edge-triggered and the calculation completes and signals before
anything is actually waiting on the CV then the waiter will not be
signaled.
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