On 11/06/2016 02:10 AM, Klemens Morgenstern wrote:
To be honest, I haven't looked that deep into boost.fiber, not sure how that would look. I'm open for any suggestions; async_pipe implements an asio-I/O object, so you probably can already use that with the interface boost.fiber provides to boost.asio.
The pattern used in Asio is to have both synchronous and asynchronous functions:
return_value foo(args); return_value foo(args, error_code); void async_foo(args, void (*)(return_value, error_code));
If async_foo supports boost::asio::async_result, then the coroutine and fiber support can be implemented seperately from your library. Well there are two things. First you can use async_pipe as any asio I/O-Object, thus this should work with fiber. Secondly there's a special case for process::system, where you can suspend the coroutine for the time the process runs. This requires a custom solution, since the event handler is different - and must be. The reason is, that I need to start
Am 06.11.2016 um 12:26 schrieb Bjorn Reese: the async-wait on posix before launching the process, which would be sort of difficult, if the corutine get's suspendend when I do that. Therefore this application needs an extra implementation, where I imagined something like that: void build(boost::asio::yield_context yield) { bp::system("g++", "-c", "foo.cpp", "-o", "foo.o", yield); bp::system("g++", "-o", "foo.exe", "foo.o", yield); }; I don't know really if anyone would like to use boost.fiber here; this however would require an implementation inside process/system.hpp. So I wouldn't add this now.