Skip to main content
1 vote
4 answers
89 views

Why only creating a task will run the coroutine in python?

There is something I can't understand in this code import asyncio async def fetch_data(param): print(f"Do something with {param}...") await asyncio.sleep(param) print(f"Done ...
M a m a D's user avatar
  • 2,191
2 votes
1 answer
140 views

boost.asio : how to cancel a synchronous task

The following code simulates short bursts of work by sleeping 1ms at a time in order to achieve a cancellable task that takes a total of 2s. That work is then launched in three different ways. The ...
Dalzhim's user avatar
  • 2,088
5 votes
1 answer
346 views

How to use C++ coroutine with Qt?

I am trying to use coroutines with Qt. Here's minimal(I guess) example to reproduce my problem Basically, bellow code is adopted from the example of cppreference here: https://en.cppreference.com/w/...
slyx's user avatar
  • 2,326
1 vote
1 answer
155 views

Why calling longjmp in a non-main stack causes the program to crash?

The following code attempts to create a simple stackful coroutine. It allocates a stack frame in the heap space by setting the rsp register and then calling a function. Afterwards, it exits the ...
algae's user avatar
  • 151
2 votes
0 answers
62 views

How can I dynamically trace and visualize memory allocation patterns of nested Python coroutines in real-time?

I'm trying to understand how memory is used in my async Python application. I have multiple coroutines running, and I want to see how much memory each one is using, especially when they are nested or ...
Optidev's user avatar
  • 218
0 votes
1 answer
84 views

How does async / await work, in a simplified abstract sense?

I am trying to understand how async / await works from a high-level, semi-abstract perspective. There are quite a few long and complicated explanations of async / await online, some of which appear ...
SapereAude's user avatar
1 vote
0 answers
103 views

Coroutine with RAII using Boost.Asio

I'm writing some test code using Boost.Asio with C++20 coroutines. Working version (manual cleanup, non-RAII) The following code works as expected. Cleanup is always called, even when an exception is ...
Takatoshi Kondo's user avatar
-1 votes
1 answer
160 views

What is the idiomatic way for a coroutine to release a strand?

Let's assume I have a coroutine running on a strand. I would like the completion to be posted to the parent executor of the strand (i.e. : a thread_pool) while also releasing the strand. What is the ...
Dalzhim's user avatar
  • 2,088
1 vote
0 answers
77 views

Lua preemptive multitasking and supporting nested coroutines

I am trying to write a scheduler for a virtual computer that runs Lua and is transparent to the user (i.e.; no coroutine. yields needed) and would still like the user to be able to create coroutines ...
RRKS101_1 TF2's user avatar
2 votes
1 answer
122 views

declare return_void / return_value conditionally

I've tried std::enable_if and requires: template <typename Ret> struct promise_type { auto get_return_object() {/*...*/} auto initial_suspend() {/*...*/} auto return_void() -> std:...
shynur's user avatar
  • 507
3 votes
1 answer
102 views

Are `std::noop_coroutine` and `noop_coroutine_handle` redundant?

In GCC 15, std::noop_coroutine's definition is { return std::noop_coroutine_handle(); } std::noop_coroutine_handle is defined by: using noop_coroutine_handle = std::coroutine_handle<std::...
shynur's user avatar
  • 507
2 votes
0 answers
90 views

C++ Coroutine task class strange issue

Basically, the whole idea is something like the Task implementation in C# where functions can return Task<T> that callers can await on. For some reason, TestFuncAsync runs correctly the first 2 ...
InfiniPLEX's user avatar
-7 votes
1 answer
265 views

Are Cgo implementing functions allowed to arbitrarily manipulate the stack pointer? [closed]

I would like to know whether Cgo implementing functions are allowed to arbitrarily manipulate the stack pointer. The motivation for this is to allow the use of coroutines on the C side of the call. ...
Hammdist's user avatar
  • 214
0 votes
0 answers
68 views

When is `async for` faster than `for` (python)?

In python, one can replace for [...] in [generator] by async for [...] in [awaitable generator]. Clearly, this lowers the overall execution time of a program if the [generator] contains some slow I/O ...
dimitsev's user avatar
  • 137
0 votes
1 answer
53 views

Android, how to print out coroutine id or name on a custom log function

I want to modify this log helper function to print out coroutine id or name. @JvmInline value class MyLogger(private val tag: String) { fun log(level: Level, e: Throwable? = null, ...
Cindy's user avatar
  • 273

15 30 50 per page
1
2 3 4 5
160