Boost logo

Boost :

Subject: Re: [boost] Boost candidate similar to asyncplusplus
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2014-01-24 02:03:35


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/executors

[4]http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3785.pdf
[5] https://github.com/boostorg/thread/tree/develop/example


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