All Questions
221
questions
1
vote
1
answer
39
views
How to run a Lua coroutine in C++ with sol3?
I'm using sol2 (v3.3.0) in C++ to run Lua coroutines. I want to pass a Lua function to C++ and execute it as a coroutine. However, my attempts to convert sol::function to sol::coroutine are not ...
3
votes
1
answer
51
views
Why can't I read from the stdout/stderr of a process spawned with forkpty in the C++20 coroutines + Asio single-threaded multi-coroutine model?
I am new to corotine and asio.
I am working on a local process management tool where a client is responsible for launching a program. This client sends commands to a backend daemon that manages the ...
1
vote
0
answers
78
views
Boost.Cobalt: how to use channels from a C API callback?
I want to use a C API in a pipeline of coroutines communicating through channels.
This is my first try with coroutines and my knowledge of them is limited.
The shape of the pipeline is:
-------- 1 ...
1
vote
1
answer
120
views
boost::asio compatible awaitable condition variable
I want to create a class that is compatible with boost::asio::awaitable that allows waiting on a condition variable asynchronously.
This is my attempt, but I honestly have no idea what I am doing
...
2
votes
1
answer
86
views
Boost.Asio default token support causes free function calling ambiguous error
Overview
I wrote some network client class named client based on Boost.Asio. The client uses boost::asio::async_read() internally to read bytes until expected bytes.
When I added default completion ...
0
votes
0
answers
84
views
Is there a way to intercept stack overflow in Boost::Asio coroutines before it happens?
I have recently spent 2 days debugging a crash of the program that turned out to
be caused by exhaustion of the boost::coroutine stack (which is by default of a very moderate size - 128k).
After I ...
0
votes
0
answers
59
views
How to wait multiple dynamic number of awaitable functions parallely
I am using Boost 1.84.0.
Boost Asio has some of multiple parallel co_wait functionality.
I realized that the number of waiting elements are sometimes static but sometimes dynamically decided.
Static ...
2
votes
1
answer
109
views
Can asio co_composed lambda function capture this pointer?
I've read this Q&A.
Lambda lifetime explanation for C++20 coroutines
If I understand correctly, lambda expression with capture something is not safe if the lambda expression is used as coroutine ...
2
votes
0
answers
566
views
C++20 coroutines and C++26 fibers: performance of calls and of context switches
I have been reading this paper about the addition of fiber_context to the C++ standard library: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p0876r15.pdf. I have been researching about (...
0
votes
1
answer
105
views
Terminal commands implemented as C++20 coroutines
I'm programming my project in modern C++20. This app is like a terminal/console in graphics mode, where you can type commands with their respective parameters, the terminal will recognize the first ...
-1
votes
1
answer
218
views
"Scripting" with C++ coroutines
I'm trying to implement a simple scripting system for game enemies using coroutines as behavior scripts. As many average C++ coders, I'm having hard time wading through convoluted std::coroutine stuff ...
0
votes
0
answers
36
views
How to mix thread and asio?
As far as I know, a coroutine should not have blocking code. But some third party libraries have blocking code, so if I want to use them in a coroutine without blocking the current coroutine, shouldn'...
3
votes
1
answer
278
views
Is there any elegant way to combine asio::co_composed and std::variant?
Question
I want to treat connection classes that has same signature member functions. For example, both tcp and tls are kind of connection class. They have send() member function template that ...
1
vote
0
answers
86
views
is it safe for a coroutine generator to iterate over a string_view?
I am starting with c++ coroutines and I have an implementation of a generator. It works fine, but I am worried about lifetimes. Specifically I saw warnings about not using captures in lambdas for ...
1
vote
1
answer
83
views
What is happend if a completion handler is neither invoked nor stored with C++20 coroutine?
Overview
When I use BoostAsio's CompletionToken facility, I design that completion_handler generated from CompletionToken finally invoked.
But I am interested in the behavior if completion_handler is ...