Boost logo

Boost Users :

Subject: [Boost-users] [thread] Feature request: set_value/exception with deferred notification (not at_thread_exit)
From: TONGARI J (tongari95_at_[hidden])
Date: 2017-02-27 05:24:39


boost::promise (so does std::promise) only supports set_value/exception and
their at_thread_exit variants, while the at_thread_exit variants
support deferred notification, but the point to trigger the notification is
restricted to thread-exit. This is not sufficient for, e.g. coroutine usage.

This is the same problem as shown in this post:
https://www.reddit.com/r/cpp/comments/4ctj2a/visual_studio_2015_update_2_co_awaitco_return/

If you want to write a "correct" adaptor for boost::future, currently you
have to use extra storage when you get the return-value from the coroutine,
and set the promise until final_suspend is reached.

To efficiently address the problem, we need something like:
* promise::set_value_deferred
* promise::set_exception_deferred
* promise::notify_deferred

Thoughts?



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