Subject: Re: [boost] [threads / signals2] Win events replace by boost signals (threadsafe)
From: Fu ji (fujimailing_at_[hidden])
Date: 2015-03-25 03:57:05
I read about condition variable and it's also not the best idea, because we
can receive signal only if we actually wait in this time. For example:
std::cout << "Set" << std::endl;
std::cout << "After" << std::endl;
std::cout << "Before wait" << std::endl;
bool result = cond.timed_wait(lock,
std::cout << result;
and we have 0 as result. Probably i should write some wrapper on cond
variable if i would like to have this functionality.
2015-03-24 23:40 GMT+01:00 Gavin Lambert <gavinl_at_[hidden]>:
> On 24/03/2015 22:28, Fu ji wrote:
>> Condition variable can be a really good solution to my problem, I have
>> problem with WaitForMultipleObjects because with cond_var I have to check
>> all "events" in loop with cond.timed_wait. There is a better solution ?
> If the events are intended to signal that data is available somewhere,
> then you could consider replacing them with futures instead, which can
> supply the data at the same time. There is a way to wait for one or all of
> a set of multiple futures, although not with a timeout.
> Unsubscribe & other changes: http://lists.boost.org/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk