2,362
questions
0
votes
0
answers
27
views
How can I improve performance of my code? [closed]
I am currently working on a small project (FPS) in unity for learning purposes. I implemented an EnemyBehaviour script to handle the logic of the enemy when it is in the scene. This worked pretty well ...
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 ...
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 ...
1
vote
1
answer
42
views
Why python runs the unused task1
In this python code that is mostly sample code for tasks and routins:
import asyncio
async def say_after(delay, what):
await asyncio.sleep(delay)
print(what)
async def main():
task1 = ...
0
votes
1
answer
32
views
How to simplify MVVM Repository function using Room and Retrofit
Below is ViewModel class and Repository class of Android MVVM design pattern.
(1) ViewModel calls a function of Repository in Coroutine.
(2) Then Repository checkes data in SQLite.
(3) If there is no ...
-1
votes
1
answer
33
views
How to run 3rd function after running two functions parallel with Kotlin Coroutine
I am trying to run 2 functions in parallel, and after that I wanna start 3rd function with the result from the first 2 functions.
I searched Google and StackOverflow and I tried below code.
But func2()...
0
votes
1
answer
37
views
Using state machines instead of coroutines [closed]
Within my Unity game I have various NPCs that do different tasks at different times. Everything is coded using coroutines as it's all I knew when starting out. The NPC will use a coroutine to decide ...
2
votes
1
answer
23
views
coroutine channel - channel capacity is 3 but send 4 items before receive
This is my test code.
test("capacity = 3, but send 4 before receive") {
val current = System.currentTimeMillis()
val channel = Channel<Int>(capacity = 3)
...
0
votes
1
answer
59
views
Run multiple async blocking functions simultaneously - Python
I am new to Python and coroutines, I am trying to leverage Python's asyncio library to parallel process a blocking function. I am using python 3.8.6. I have a blocking function that takes in a ...
0
votes
1
answer
88
views
Python Warning: Coroutine 'create_task' is not awaited
I am using Python and PyCharm, I am trying to offload database writing using asyncio but am having trouble with IDE warnings
In my main.py I start up tasks in this manner
db_logging_monitoring_task = ...
0
votes
1
answer
52
views
How to call a suspend function of a kotlin class from a java class without blocking the underlying thread
I have a following kotlin class
class KotlinClass() {
suspend fun executeSuspend(): ResultClass {
.....
}
}
I want to call this suspend function from a Java class.
public class JavaClass {
...
1
vote
2
answers
44
views
How should I correctly configure tasks when using sockets in python?
I have this small snippet which I intend to have function as a server, I have managed to get the socket to connect to the client but cannot send data due to errors.
import asyncio
import json
import ...
1
vote
3
answers
130
views
Run an async function from a sync function within an already-running event loop
In my Python application, I have a sync function boo() that is called inside a running event loop. boo() has to get some data from foo(arg1, arg2), which is an async function.
Unfortunately, I can't ...
0
votes
0
answers
38
views
Airflow 2.7.2 Trigger badld-written code block Triggerer's async thread
I am running Airflow version 2.7.2, and I constantly see the issue in my trigger log.
Triggerer's async thread was blocked for 0.50 seconds, likely by a badly-written trigger. Set PYTHONASYNCIODEBUG=1 ...
0
votes
2
answers
48
views
Can someone explain to me why my coroutine works wrong?
Ok,so I do some of my learning stuff and I need my elevators to stop for a few secs
private IEnumerator ReversePlatform()
{
yield return new WaitForSeconds(2);
_AccuTime = 0;
...