coroutine Questions
3
I build a chatapplication using Aiohttp server and using python-socket-io. When i tried to host this application in nginx i found this error in supervisor error from error log of supervisor(error l...
Correctitude asked 27/5, 2022 at 5:19
3
Solved
Im making an Alarm app, and using AlarmManager to set alarms.
Im saving every alarm using Room after running the setAlarm on the AlarmManager, so I can later restore them if the phone gets turned o...
Hedvige asked 18/10, 2022 at 13:19
3
Solved
I follow the MVP pattern + UseCases to interact with a Model layer. This is a method in a Presenter I want to test:
fun loadPreviews() {
launch(UI) {
val items = previewsUseCase.getPreviews() //...
Tantrum asked 16/4, 2018 at 19:42
11
Solved
I'm trying to make a background call to my local database and update the UI with the results using coroutines.
Here is my relevant code:
import kotlinx.coroutines.experimental.*
import kotlinx.cor...
Ricotta asked 6/10, 2018 at 9:31
20
Solved
I doubt it can be done portably, but are there any solutions out there? I think it could be done by creating an alternate stack and reseting SP,BP, and IP on function entry, and having yield save I...
3
Solved
I was working on making a unit move through a grid in Unity2d. I got the movement to work without problems.
I would want the function MovePlayer to wait until the coroutine is finished before movin...
Baalbek asked 4/6, 2017 at 22:3
8
Solved
I am trying to debug a coroutine in Unity using VS2017.
When I attach VS to Unity and set a breakpoint inside the IEnumerator method I get the error "Breakpoint will not be hit"
It is discusse...
Felten asked 13/10, 2017 at 0:8
6
I've been using lifecyclesScope's launchWhenResumed for a long time now, but it seems to be deprecated. The documentation says to use repeatOnLifecycle() but I only want the code to run once, just ...
Scutage asked 4/3, 2023 at 12:3
10
Solved
I have some coroutines:
IEnumerator a(){ /* code */ }
IEnumerator b(){ /* code */ }
IEnumerator c(){ /* code */ }
I want to create a coroutine that calls a, b and c in parallel but wait for all ...
Colley asked 15/12, 2019 at 22:13
3
I'm developing an Android library,
When the user receives a push notification it may contain deep links, that I need to return to the app.
I did in kotlin with no problem.
This is the function t...
Esra asked 27/5, 2020 at 18:20
7
What I want to achieve?
I have a task to download images but as the screen scrolls it will cancel previous downloads and start downloading new ones. I want that when it cancel the coroutine downloa...
Carboni asked 8/9, 2021 at 6:8
3
Solved
I cannot wrap my head around type hinting a Coroutine. As far as I understand, when we declare a function like so:
async def some_function(arg1: int, arg2: str) -> list:
...
we effectively dec...
Hittel asked 4/8, 2022 at 18:17
3
I need to handle current and previous value in flow collect, so I need some operator that acts like that:
----A----------B-------C-----|--->
---(null+A)---(A+B)---(B+C)--|--->
One idea is s...
Our asked 15/6, 2022 at 5:26
4
Solved
How to provide scope or how to call suspend function from Service Android?
Usually, activity or viewmodel provides us the scope, from where we can launch suspend but there is no similar thing in Se...
Mechanism asked 14/8, 2020 at 2:28
9
Solved
I would like to do some stuff in Java that would be clearer if written using concurrent routines, but for which full-on threads are serious overkill. The answer, of course, is the use of coroutines...
9
Solved
How can I find out if a function or method is a normal function or an async function? I would like my code to automatically support normal or async callbacks and need a way to test what type of fun...
Trudey asked 18/3, 2016 at 5:13
2
Solved
Why do we need the asyncio.coroutine decorator? What functionality does it provide?
For example:
# import asyncio
# @asyncio.coroutine
def gen():
value = yield("Started")
print(value)
a = gen(...
Midwife asked 5/11, 2017 at 10:57
8
Solved
I understand the principle of coroutines. I know how to get the standard StartCoroutine / yield return pattern to work in C# in Unity, e.g. invoke a method returning IEnumerator via StartCoroutine ...
Iraqi asked 17/10, 2012 at 10:30
3
Solved
When implementing classes that have uses in both synchronous and asynchronous applications, I find myself maintaining virtually identical code for both use cases.
Just as an example, consider:
fr...
Pammy asked 14/3, 2019 at 0:4
5
Solved
I have a collection of objects, which I need to perform some transformation on. Currently I am using:
var myObjects: List<MyObject> = getMyObjects()
myObjects.forEach{ myObj ->
someMeth...
Thug asked 8/8, 2017 at 18:25
5
Solved
For someone who has some async experience from other languages (Python/JavaScript), when talking about async/await there is always an assumption that there is an event loop somewhere. But for C++ I...
Schauer asked 19/2, 2021 at 16:26
3
Solved
I am trying to learn coroutines and so I fire up IntelliJ and create a scratch file. But when I type in my coroutines I get compiler complaints such as runBlocking is an unresolved reference. So th...
Venturous asked 26/9, 2018 at 16:24
3
Imagine we have an iterator, say iter(range(1, 1000)). And we have two functions, each accepting an iterator as the only parameter, say sum() and max(). In SQL world we would call them aggregate fu...
Mundane asked 26/4, 2018 at 9:16
3
Solved
Is there a specific language implementation in Kotlin which differs from another language's implementation of coroutines?
What does it mean that a coroutine is like a lightweight thread?
What is t...
Harvey asked 25/3, 2017 at 20:50
14
What is a coroutine? How are they related to concurrency?
Soupandfish asked 16/2, 2009 at 15:36
1 Next >
© 2022 - 2024 — McMap. All rights reserved.