<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0"><channel><title>分类：Kotlin - LT技术站</title><link>https://lautung.com/categories/kotlin</link><atom:link href="https://lautung.com/categories/kotlin/feed/categories/kotlin.xml" rel="self" type="application/rss+xml"/><description>纸上得来终觉浅，绝知此事要躬行！</description><generator>Halo v2.27.2</generator><language>zh-cn</language><image><url>https://lautung.com/upload/ChatGPT%20Image%202026%E5%B9%B47%E6%9C%8810%E6%97%A5%2002_45_40(1).webp</url><title>分类：Kotlin - LT技术站</title><link>https://lautung.com/categories/kotlin</link></image><lastBuildDate>Wed, 18 Nov 2026 04:46:13 GMT</lastBuildDate><item><title><![CDATA[Kotlin 协程精讲：从结构化并发到 Channel 多路复用]]></title><link>https://lautung.com/archives/kotlin-coroutines</link><description><![CDATA[<img src="https://lautung.com/plugins/feed/assets/telemetry.gif?title=Kotlin%20%E5%8D%8F%E7%A8%8B%E7%B2%BE%E8%AE%B2%EF%BC%9A%E4%BB%8E%E7%BB%93%E6%9E%84%E5%8C%96%E5%B9%B6%E5%8F%91%E5%88%B0%20Channel%20%E5%A4%9A%E8%B7%AF%E5%A4%8D%E7%94%A8&amp;url=/archives/kotlin-coroutines" width="1" height="1" alt="" style="opacity:0;">协程的核心是结构化并发避免泄漏Job树。子协程需明确所属作用域（coroutineScope管理关联生命周期，supervisorScope隔离失败），不要将Job launch为孤儿根，测试时使用runTest。调度器决定resume线程，主线程恢复用Main.immediate，阻塞IO用IO后者避免阻塞关键路径，不要混用锁机制。取消通过协程协作实现，cancel触发挂起点，主动检查isActive保护CPU死循环。异常向上传播，采用 supervisorscope隔离失败，异常处理栈建议集中到底层，避免深嵌层吞异常。Channel用于精确背压的多消费者竞争场景，需明确关闭方，避免互等死锁。测试可以发现99%的问题，生产环境禁止在作用域外频繁启动协程。核心收益是用作用域组织Job树，配合Channel和正确调度，实现可控不泄漏的并发流程，避免僵尸协程和死锁。]]></description><guid isPermaLink="false">/archives/kotlin-coroutines</guid><dc:creator>LTT</dc:creator><category>Kotlin</category><pubDate>Wed, 16 Sep 2026 06:22:09 GMT</pubDate></item><item><title><![CDATA[Kotlin Flow 一 概述]]></title><link>https://lautung.com/archives/Ps4Yk9If</link><description><![CDATA[<img src="https://lautung.com/plugins/feed/assets/telemetry.gif?title=Kotlin%20Flow%20%E4%B8%80%20%E6%A6%82%E8%BF%B0&amp;url=/archives/Ps4Yk9If" width="1" height="1" alt="" style="opacity:0;">一、一句话说清：Flow 是什么？ Flow = 协程版的「数据流」 用来处理 异步、连续、多个值 的序列。 类比一下你就懂： 返回单个值：suspend fun：协程挂起函数 返回多个连续值：Flow&lt;T&gt;：数据流 它就是协程世界里的 RxJava / LiveData]]></description><guid isPermaLink="false">/archives/Ps4Yk9If</guid><dc:creator>LTT</dc:creator><enclosure url="https://lautung.com/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fzhcover-019d1f41-478a-7003-aa2e-89615fe88dce.jpg&amp;size=m" type="image/jpeg" length="25506"/><category>Kotlin</category><pubDate>Tue, 24 Mar 2026 10:37:22 GMT</pubDate></item><item><title><![CDATA[Kotlin 协程一、概述]]></title><link>https://lautung.com/archives/PCnwEw9B</link><description><![CDATA[<img src="https://lautung.com/plugins/feed/assets/telemetry.gif?title=Kotlin%20%E5%8D%8F%E7%A8%8B%E4%B8%80%E3%80%81%E6%A6%82%E8%BF%B0&amp;url=/archives/PCnwEw9B" width="1" height="1" alt="" style="opacity:0;">协程的难点 新概念 不同编程语言，对协程的实现不同。 对线程基础不牢。 协程是什么？ 协程基于线程，它是轻量级的线程。 为什么它不是作为一个框架存在呢？Kotlin协程需要编译器，通常我们不称它为框架。 在Android中解决的问题 &lt;]]></description><guid isPermaLink="false">/archives/PCnwEw9B</guid><dc:creator>LTT</dc:creator><enclosure url="https://lautung.com/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fzhcover-019d19fd-6bf2-7119-ab87-942b69e9a17a.jpg&amp;size=m" type="image/jpeg" length="25433"/><category>Kotlin</category><pubDate>Mon, 23 Mar 2026 14:18:34 GMT</pubDate></item></channel></rss>