Boost logo

Boost :

Subject: Re: [boost] [next gen futures] Lightweight monad ready for inspection
From: Avi Kivity (avi_at_[hidden])
Date: 2015-06-20 05:44:27


On 06/19/2015 08:03 PM, Niall Douglas wrote:
> Some may remember the thread starting from
> http://boost.2283326.n4.nabble.com/next-gen-future-promise-What-to-cal
> l-the-monadic-return-type-td4676039.html and that I would firstly
> prepare an optimally lightweight monad<T> for review here before
> going on to base a next-gen lightweight future-promise on that
> monad<T>.

   BOOST_SPINLOCK_FUTURE_MSVC_HELP future_type get_future()
   {
     // If no value stored yet, I need locks on from now on
     if(!_need_locks && _storage.type==value_storage_type::storage_type::empty)
     {
       _need_locks=true;
       new (&_lock) spinlock<bool>();
     }

Isn't that the common case? Usually if you already have a value, you
return it with make_ready_future(). Otherwise, at the time of
get_future(), the promise still doesn't have a value.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk