You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to bo...@lists.boost.org, Gavin Lambert
On 26/07/2018 00:15, hawk x wrote:
> Javascript Promise creates a task chain to help develop asynchronized
> application with single thread.
>
> I did not find a good implement of this kind of "Promise" in c++
std::future::then was proposed for C++17, but didn't make it in. Boost
does support it, however, as does an STL that implements the Concurrency
TS (as std::experimental::future::then).
Additionally, Boost.Asio supports using coroutines for implementing
asynchronous tasks, which are even better than a then-chain and read
even more like plain synchronous code.
Currently coroutines are a pure library feature (supported by
Boost.Context and Boost.Coroutine), but they are expected to be
supported directly by C++20 compilers, and by C++17 compilers that
implement the Coroutine TS (VS 2017 already supports co_await, for example).
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to bo...@lists.boost.org, hawk x
boost::coroutine and std::future are all excellent solutions for
concurrency programming.
But if there's many concurrent tasks, event-loop based multi-task in SINGLE
thread will have the best performance.
while std::future is designed for mulitthread, and std::future::then is not
suitable for event-loop based multi-task in SINGLE thread,
that's why I wrote "promise-cpp".
Gavin Lambert via Boost
unread,
Jul 27, 2018, 1:58:58 AM7/27/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to bo...@lists.boost.org, Gavin Lambert
On 27/07/2018 14:13, hawk x wrote:
> boost::coroutine and std::future are all excellent solutions for
> concurrency programming.
> But if there's many concurrent tasks, event-loop based multi-task in SINGLE
> thread will have the best performance.
coroutines can be used to manage concurrent tasks on a single thread.
Boost.Asio is one way to manage those tasks with an event loop (simply
have a single thread running the io_service/io_context); additional work
can be posted both from "inside" and outside.
Boost.Fiber doesn't need fibers::future::then - just suspend the fiber. If
you need more concurrency than that, launch another fiber. then() is
redundant with coroutine and fiber concurrency.