July 2018
Intermediate to advanced
266 pages
7h 11m
English
Currently, we have a group of coroutines that are both short-lived and created inside a loop, so we are not interested in giving them specific names. In cases like this, we can have Kotlin assign an automatic identifier to each of them.
To do so, we simply need to change the configuration that we use to execute our application. By passing the -Dkotlinx.coroutines.debug VM flag, Kotlin will append a unique identifier to every coroutine that is created when we request the name of the current thread. In order to add this flag, you need to click the dropdown in the selector of Run/Debug Configuration, shown as follows, and select Edit Configurations:
Once this is done, you can add the flag in the VM Options section:
Read now
Unlock full access