-
-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coroutines support #47
Comments
@kotcrab Sweet. LibGDX |
No idea. |
The official method for creating coroutines with a context is |
I see. Nothing really strikes my mind though. I guess something like |
Not ideal, but simple and obvious. Not only does it match the module name, but also does not suggest where the code is executed ( |
I personally +1 for Or |
But that's the thing: it does not have to be executed on the main thread. If you're using coroutines in the first place, chances are half of the instructions will be executed elsewhere. Only the processing of async operations results and non-suspending methods are invoked on the rendering thread. It might give you a false impressions that time consuming methods will block your rendering. onMainThread {
val httpResponse = httpRequest(url = "example.com", method = "GET") // Net executor.
delay(1) // Timer.
val result = asynchronous { someTask() } // Context's AsyncExecutor.
} |
I don't think you meant to say "non suspending methods". Suspending methods can be on any thread including the render thread and it can be useful to use them on the rendering thread to mask state. Or am I misunderstanding here? |
That's right, I oversimplified. I should have said non-suspending methods and suspending methods that can be executed on the main thread. |
@kotcrab @sreich @raincole @MrPlow442 Can you take a look at the new module implementation and API? #57 I want your approval before merging and releasing this. |
I'm heading for ludum dare this weekend. If no one else does I can help review it next week. |
It's OK. Good luck. ; ) |
New module: ktx-async implementation. #47
ktx-async
module.Gdx.app.postRunnable
to resume coroutines executed on other threads.AsyncExecutor
instance.HttpRequest
utilities based on coroutines.Timer
API. Currently it does not support lambdas.delay
method, which does not block the main rendering thread using LibGDXTimer
.skipFrame
suspending method that resumes on the next frame usingGdx.app.postRunnable
API.Implement
ktx-async
module with asynchronous operations utilities and Kotlin 1.1 coroutines support.The text was updated successfully, but these errors were encountered: