Top "Coroutine" questions

Coroutines are a general control structure whereby flow control is cooperatively passed between two different routines without returning.

What are use cases for coroutines?

The concept of a coroutine sounds very interesting, but I don't know, if it makes sense in a real productive …

use-case coroutine
Python 3.5: "async with" results in SyntaxError. Why?

I am using Python 3.5, which, according to PEP 492 should have access to the async with syntax, yet I get a …

python python-3.x coroutine
"yield" keyword for C++, How to Return an Iterator from my Function?

Consider the following code. std::vector<result_data> do_processing() { pqxx::result input_data = get_data_from_database(); …

c++ iterator generator coroutine yield-keyword
What does the "yield from" syntax do in asyncio and how is it different from "await"

From the perspective of someone who has written asyncio code but is looking to better understand the inner workings, what …

python async-await generator python-asyncio coroutine
Python3 asyncio "Task was destroyed but it is pending" with some specific condition

Here is simplified code, which uses python3 coroutine and sets handler for SIGING and SIGTERM signals for stopping job properly: #!/…

python-3.x coroutine python-asyncio
Wait for the termination of n goroutines

I need to start a huge amount of goroutines and wait for their termination. The intuitive way seems to use …

concurrency go channel coroutine goroutine
Kotlin Coroutines : Waiting for multiple threads to finish

So looking at Coroutines for the first time, I want to process a load of data in parallel and wait …

kotlin coroutine kotlin-coroutines
COROUTINE_SUSPENDED and suspendCoroutineOrReturn in Kotlin

The idea of coroutines in kotlin was to abstract the notion of suspension and callbacks and write simple sequential code. …

jvm kotlin coroutine suspend
Python asyncio, futures and yield from

Consider the following program (running on CPython 3.4.0b1): import math import asyncio from asyncio import coroutine @coroutine def fast_sqrt(…

python future yield coroutine python-asyncio
How to upload small files to Amazon S3 efficiently in Python

Recently, I need to implement a program to upload files resides in Amazon EC2 to S3 in Python as quickly …

python amazon-web-services amazon-s3 coroutine