Questions tagged [coroutines]

Used for questions involving coroutine functionality; either from the language itself, provided by an external library, or when the code in question implements coroutines itself.

Filter by
Sorted by
Tagged with
3 votes
1 answer
256 views

Single threaded epoll based coroutine library for C++, Linux

I've implemented a small single-header library over the C++20 coroutines. This library only works on a single thread and it is limited to Linux because it is also based on epoll. The library does not ...
Pangi's user avatar
  • 145
1 vote
1 answer
88 views

sendmsg() scatter-gather coroutine awaiter, optimized suspending

My attempt at an Awaiter for sending scatter-gather data over an open file descriptor. Tested only on gcc-13.1.1 Micro-optimizing by suspending the coroutine only ...
serafean's user avatar
2 votes
2 answers
100 views

Finding files using multiple coroutines

I'm trying to write a simple program to find a certain file name within a directory tree. I use up to 30 coroutines. Is there anything wrong with this code or what needs to be improved? ...
woxihuanxiayua's user avatar
5 votes
0 answers
155 views

Single-threaded coroutine in C (Linux x86-64)

Background Story I crafted a simple single-threaded coroutine in C, running on Linux x86-64. Short Technical Explanation 1) Task There are two types of tasks in this implementation. Main task. This ...
Ammar Faizi's user avatar
5 votes
1 answer
315 views

C++20 Coroutine Task

This project is the natural extension to my attempt to make a templatedgenerator coroutine. This time, I tried what I called a "...
rafoo's user avatar
  • 325
5 votes
2 answers
4k views

C++20 Coroutine Generator

Here is a coroutine generator class... Just like Python yields. It was a bit tedious to support both co_yield and co_return (...
rafoo's user avatar
  • 325
3 votes
0 answers
97 views

Experimenting with C++20 coroutines to create Python-style generator functions

I've been playing around with the coroutines implementation in gcc 10.2.0 (Debian build) based on the sparse documentation at https://en.cppreference.com/w/cpp/language/coroutines . The target, for ...
Daniel Schepler's user avatar
4 votes
1 answer
2k views

Correct flow between Kotlin, Realm and ViewModels using Coroutines

I'm stepping back into Android after being away from it for about a year. Trying to get an out of date app of mine back on its feet, and continuing work on it. The app was written using Java, MVP, ...
BHogan's user avatar
  • 41
2 votes
1 answer
560 views

Getting a value with timeout using Kotlin coroutines

So, here's a task. A background thread may or may not call all of it's listeners some time after sendRequest() was called (in other words ...
sibwaf's user avatar
  • 21
3 votes
0 answers
527 views

Python coroutines to write files

I'm refactoring a monster 176-line function into something more sensible and more testable. The function as it stands fails the 'one thing and thing well' test by doing many things: Indexing through ...
iusctx's user avatar
  • 31
2 votes
0 answers
106 views

Bigger coroutine class

This is my attempt to implement the style of coroutines I described in my answer to Small coroutine class. What do you think of it? (My unusual dialect is due to my compiling with ...
Quuxplusone's user avatar
  • 19.3k
3 votes
1 answer
257 views

Small coroutine class

What do you think about this? ...
user1095108's user avatar
  • 1,414
3 votes
0 answers
353 views

Recursively generate combinations while using Boost Coroutines

I've tried out implementing a combination generator using boost coroutines. It accepts an array of possible values and generates one array at a time for each combination. As a limitation, it only ...
D. Jurcau's user avatar
  • 3,010
21 votes
1 answer
757 views

Coroutines in C

Please have a look at this little coroutines library ccoro: http://sam.nipl.net/code/ccoro I'd appreciate a general code and style review, and your kind comments! ...
Sam Watkins's user avatar
11 votes
2 answers
4k views

How can this simple coroutine implementation be improved?

This is a quick and dirty implementation of coroutines that implements yield by saving and restoring the stack to and from the heap. Here's an earlier version, which does the most naive possible thing,...
dan's user avatar
  • 309