Boost candidate similar to asyncplusplus
Hello, I was wondering if there is anything similar to asyncplusplus [1] here in Boost land. I just found out about the library and I specially liked the task chaining syntax [2]: --- async::spawn([] { return 42; }).then([](int result) { return result; }).then([](task<int> parent) { std::cout << parent.get() << std::endl; }); --- This is something I would love to see in Boost. So I ask: 1) Are there any similar Boost candidates for task scheduling? 2) If not, is ASIO up to this with some adaptation? I felt specially inclined to ask this here because of all the discussion taking place over the recently reviewed Fibers library and the fundamentals of asynchronous processing. Very interesting thoughts being discussed there. And something more higher level (but not necessarily IO bound) might be helpful. Best regards, Rodrigo Madera [1] https://github.com/Amanieu/asyncplusplus [2] https://github.com/Amanieu/asyncplusplus/wiki/Tutorial
I would like to complement my questions with the reference of N3785. Looks like it's very much related. Madera [1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3785.pdf
Le 23/01/14 22:02, Rodrigo Madera a écrit :
Hello,
I was wondering if there is anything similar to asyncplusplus [1] here in Boost land.
I just found out about the library and I specially liked the task chaining syntax [2]:
--- async::spawn([] { return 42; }).then([](int result) { return result; }).then([](task<int> parent) { std::cout << parent.get() << std::endl; }); --- Hi,
I'm working on something like that [3] base on [4]. I expect to be ready for release it for the next release, but I have yet some test cases that are failing on some platforms, and some limitations on the interface. There are some examples/tests in [5]. Your example would be something like that async(ex,[] { return 42; }).then(ex, [](int result) { return result; }).then(ex, [](task<int> parent) { std::cout << parent.get() << std::endl; }); Note the ex parameter. ex is an executor/scheduler. The library provides some of the executors proposed in [4], as a basic_thread_pool. The main difference between N3785 and my library is that the executors are models of an Executor concept instead of inheriting from a base executor class. I'm yet working on a scheduled_executor class that wraps an Executor to provide time base scheduler operations. In order to be able to do something closer to your example we will need a default executor/scheduler which I have not yet and I don't know if I would provide one in a near future.
This is something I would love to see in Boost.
So I ask:
1) Are there any similar Boost candidates for task scheduling? 2) If not, is ASIO up to this with some adaptation? I don't master ASIO so I let others respond here.
I felt specially inclined to ask this here because of all the discussion taking place over the recently reviewed Fibers library and the fundamentals of asynchronous processing. Very interesting thoughts being discussed there. And something more higher level (but not necessarily IO bound) might be helpful.
Best regards, Rodrigo Madera
[1] https://github.com/Amanieu/asyncplusplus [2] https://github.com/Amanieu/asyncplusplus/wiki/Tutorial
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Best, Vicente [3] https://github.com/boostorg/thread/tree/develop/include/boost/thread/executo... [4]http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3785.pdf [5] https://github.com/boostorg/thread/tree/develop/example
On 23 Jan 2014 at 19:02, Rodrigo Madera wrote:
1) Are there any similar Boost candidates for task scheduling? 2) If not, is ASIO up to this with some adaptation?
ASIO has already been extended in this way in proposed Boost.AFIO, currently in the peer review queue. AFIO does *not* replicate the syntactic convenience sugar though, so you'll have to do more typing and binding. AFIO *has* been intentionally designed to be extended later however with the right metaprogramming once more solidity emerges at WG21. To be honest I'm also hoping to reuse Vicente's additions implementing then() to Boost.Thread rather than duplicating identical metaprogramming machinery. That said, I may go for a "partial then()" as early as next week.
I felt specially inclined to ask this here because of all the discussion taking place over the recently reviewed Fibers library and the fundamentals of asynchronous processing. Very interesting thoughts being discussed there. And something more higher level (but not necessarily IO bound) might be helpful.
The work I intend to do to AFIO next week is preparation for including coroutines support. Niall -- Currently unemployed and looking for work in Ireland. Work Portfolio: http://careers.stackoverflow.com/nialldouglas/
I was wondering if there is anything similar to asyncplusplus [1] here in Boost land.
I just found out about the library and I specially liked the task chaining syntax [2]:
--- async::spawn([] { return 42; }).then([](int result) { return result; }).then([](task<int> parent) { std::cout << parent.get() << std::endl; }); ---
This is something I would love to see in Boost.
So I ask:
1) Are there any similar Boost candidates for task scheduling? 2) If not, is ASIO up to this with some adaptation?
I felt specially inclined to ask this here because of all the discussion taking place over the recently reviewed Fibers library and the fundamentals of asynchronous processing. Very interesting thoughts being discussed there. And something more higher level (but not necessarily IO bound) might be helpful.
Not in Boost, but heavily based on Boost and aligned with it in terms of coding and general style: https://github.com/STEllAR-GROUP/hpx/. The library exposes an interface aligned with the C++11 Standard on top of a (highly efficient) fiber-like threading system: future<void> f = async([]{ return 42; }).then([](future<int> result) { return result; }).then([](future<int> parent) { cout << parent.get() << endl; }); Many of the proposed extensions to std::future are supported as well (when_all/when_any, etc.). Regards Hartmut --------------- http://boost-spirit.com http://stellar.cct.lsu.edu
participants (4)
-
Hartmut Kaiser
-
Niall Douglas
-
Rodrigo Madera
-
Vicente J. Botet Escriba