Coroutines in Kotlin provide a way to create asynchronous programs in a more fluent and scalable manner. Let’s start with the Coroutines’ fundamental concepts to help us understand what they are and how they fit into asynchronous programming. Then, we’ll move to more advanced topics, such...
Kotlin 1.1 introduced coroutines, a new way of writing asynchronous, non-blocking code (and much more). In this tutorial we will go through some basics of using...
在协程等待的过程中, 线程会返回线程池, 当协程等待结束, 协程会在线程池中一个空闲的线程上恢复. (The thread is returned to the pool while the coroutine is waiting, and when the waiting is done, the coroutine resumes on a free thread in the pool.) 启动协程 启动一个新的协程, 常用的主要有...
Kotlin 1.1 introduced coroutines, a new way of writing asynchronous, non-blocking code (and much more). In this tutorial we will go through some basics of using Kotlin coroutines with the help of the kotlinx.coroutines library, which is a collection of helpers and wrappers f...
CoroutineName:给协程取个名字,方便调试 CoroutineExceptionHandler:指定协程的异常处理器,用以处理未被捕获的异常 这里主要介绍一下Job,CoroutineDispatcher和Name,至于ExceptionHandler留到后面讲异常处理时再细讲。 Job 用launch创建一个协程时也会返回一个Job对象,它就是新创建的协程的句柄,但更好的方式是通过launch的...
Kotlin Coroutines Tutorial ]]> 1. Introduction In Kotlin, Flow is essential for managing asynchronous data streams, especially within reactive programming contexts like Android development. Moreover, properly testing flows is essential to ensure that data is emitted as expected, transformations ...
March 29, 2025 Auto-reload in Ktor In this, short quide, I will show you how to enable the development mode and auto-reload feature in Ktor application. March 25, 2025 MockK with Coroutines [5/5] In the last article in a series, we are going to learn everything we need to know ...
CoroutineName:给协程取个名字,方便调试 CoroutineExceptionHandler:指定协程的异常处理器,用以处理未被捕获的异常 这里主要介绍一下Job,CoroutineDispatcher和Name,至于ExceptionHandler留到后面讲异常处理时再细讲。 Job 用launch创建一个协程时也会返回一个Job对象,它就是新创建的协程的句柄,但更好的方式是通过launch的...
People are using Kotlin coroutines for implementing many asynchronous mechanisms available in other languages. For example – async/await from C# and ECMAScript, channels and select from Go, and generators/yield from C# and Python. This open-source, object-oriented language offers significant advantag...
Kotlin 1.1 introduced coroutines, a new way of writing asynchronous, non-blocking code (and much more). In this tutorial we will go through some basics of using Kotlin coroutines with the help of the kotlinx.coroutines library, which is a collection of helpers and wrappers for existing Java...