|
Boost : |
Subject: Re: [boost] Boost.Fiber mini-review September 4-13
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2015-09-04 15:39:52
On 09/04/2015 09:08 PM, Oliver Kowalke wrote:
> 2015-09-04 21:14 GMT+02:00 Thomas Heller <thom.heller_at_[hidden]>:
>
> Could you please elaborate a bit why non-allocating futures wouldn't
>> require a mutex? Or more generally, a execution context suspension/yield
>> mechanism?
>>
>
> I mean no std::mutex (pthread_mutex) is required.
> a protocol, utilizing atomics, between future and promise does the job -
> http://blog.forecode.com/2012/05/23/a-non-allocating-stdfuturepromise/
> in 'void promise::set_value(R && r)' boost::this_fiber::yield() could be
> used, if the future is not ready yet (e.g. AS(future->state, 0, 'R') fails).
The problematic portion in std::mutex/boost::mutex is exactly the
missing mechanism how to yield in the correct way. Even if you implement
a mechanism like in the blog post you mentioned, the problem hasn't been
solved.
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk