Skip to main content

All Questions

Tagged with
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 ...
Harumaki's user avatar
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 ...
Jarviswu's user avatar
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 ...
dvnh87's user avatar
  • 11
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 ...
bustus_primus's user avatar
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 ...
Takatoshi Kondo's user avatar
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 ...
Alex Jenter's user avatar
  • 4,422
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 ...
Takatoshi Kondo's user avatar
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 ...
Takatoshi Kondo's user avatar
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 (...
ABu's user avatar
  • 11.5k
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 ...
darknight's user avatar
-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 ...
nj16's user avatar
  • 99
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'...
vipcxj's user avatar
  • 942
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 ...
Takatoshi Kondo's user avatar
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 ...
Dix's user avatar
  • 116
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 ...
Takatoshi Kondo's user avatar

15 30 50 per page
1
2 3 4 5
15