<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Coroutines on terrakok</title><link>https://terrablog.pages.dev/tags/coroutines/</link><description>Recent content in Coroutines on terrakok</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 02 Nov 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://terrablog.pages.dev/tags/coroutines/index.xml" rel="self" type="application/rss+xml"/><item><title>Multithreading in Compose Multiplatform Web Apps</title><link>https://terrablog.pages.dev/blog/multithreading-compose-multiplatform-web-apps/</link><pubDate>Mon, 02 Nov 2026 00:00:00 +0000</pubDate><guid>https://terrablog.pages.dev/blog/multithreading-compose-multiplatform-web-apps/</guid><description>&lt;p&gt;The standard way to work with multithreading and asynchronous code in Kotlin is to use the &lt;code&gt;kotlinx.coroutines&lt;/code&gt; library.&lt;/p&gt;&#10;&lt;p&gt;To make code execution easier to manage, the library provides several standard dispatchers:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;Dispatchers.Main&lt;/code&gt; — for working on the UI thread, if the platform has one.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;Dispatchers.Default&lt;/code&gt; — for CPU-intensive work, such as calculations and data processing. Used by default when no dispatcher is specified.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;Dispatchers.IO&lt;/code&gt; — for blocking I/O operations, such as file operations or blocking network calls.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;Dispatchers.Unconfined&lt;/code&gt; — starts a coroutine on the current thread until its first suspension. After that, the coroutine may resume on a thread chosen by the suspending operation.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;In Compose Multiplatform apps, application code usually starts running on &lt;code&gt;Dispatchers.Main&lt;/code&gt;. So all blocking and heavy operations need to move to other threads to avoid blocking the UI.&lt;/p&gt;</description></item></channel></rss>