# suspend

Published articles for suspend.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Fixing black screens after suspend on Ubuntu 25.10 with NVIDIA 580 drivers

DevFeed: [Fixing black screens after suspend on Ubuntu 25.10 with NVIDIA 580 drivers](<https://devfeed.tech/articles/when-ubuntu-updates-break-nvidia-again-25164.md>)

Original publisher: [Read original article](<https://www.ivanmorgillo.com/2025/12/11/when-ubuntu-updates-break-nvidia-again/>)

Author: Ivan Morgillo

Published: 2025-12-11T09:18:40Z

Content type: tutorial

Language: en

Sources: [Ivan Morgillo](<https://devfeed.tech/sources/ivan-morgillo.md>)

Topics: [Nvidia](<https://devfeed.tech/topics/nvidia.md>), [Ubuntu](<https://devfeed.tech/topics/ubuntu.md>), [boot](<https://devfeed.tech/topics/boot.md>), [Kernel](<https://devfeed.tech/topics/kernel.md>), [xfce](<https://devfeed.tech/topics/xfce.md>)

Tags: [black-screen](<https://devfeed.tech/tags/black-screen.md>), [config](<https://devfeed.tech/tags/config.md>), [driver-fix](<https://devfeed.tech/tags/driver-fix.md>), [drivers](<https://devfeed.tech/tags/drivers.md>), [grub](<https://devfeed.tech/tags/grub.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [linux](<https://devfeed.tech/tags/linux.md>), [nvidia](<https://devfeed.tech/tags/nvidia.md>), [suspend](<https://devfeed.tech/tags/suspend.md>), [ubuntu](<https://devfeed.tech/tags/ubuntu.md>), [updates](<https://devfeed.tech/tags/updates.md>), [xfce](<https://devfeed.tech/tags/xfce.md>)

### AI overview

This tutorial describes a black screen occurring when an Ubuntu system resumes from suspend with NVIDIA drivers. For Ubuntu 25.10 and NVIDIA 580 drivers, it reports that disabling NVIDIA DRM modesetting in the GRUB configuration resolved the issue and preserved the XFCE session after wake-up.

### Source excerpt

Every now and then I update Ubuntu, sip my coffee, install all-the-things... and everything looks fine. Until I suspend. Because of course the moment the PC suspends, NVIDIA decides to have an existential crisis. I start the machine again and black screen. GODDAMMIT! This happened again today, and because Future Me will not remember any [...]

## @isolated(any)

DevFeed: [@isolated(any)](<https://devfeed.tech/articles/isolated-any-28998.md>)

Original publisher: [Read original article](<https://nshipster.com/isolated-any/>)

Author: Matt Massicotte

Published: 2025-08-04T07:00:00Z

Content type: article

Language: en

Sources: [NSHipster](<https://devfeed.tech/sources/nshipster.md>)

Topics: [async](<https://devfeed.tech/topics/async.md>)

Tags: [actor](<https://devfeed.tech/tags/actor.md>), [async](<https://devfeed.tech/tags/async.md>), [suspend](<https://devfeed.tech/tags/suspend.md>), [swift](<https://devfeed.tech/tags/swift.md>)

### AI overview

This article explains why @isolated(any) was introduced, using async functions to show how isolation can change when a task suspends. It also describes the tradeoff between flexible function types and the loss of statically inspectable isolation information.

### Source excerpt

There are cases where just a little more visibility and control over how to schedule asynchronous work can make all the difference.

## How to turn callback functions into suspend functions or Flow

DevFeed: [How to turn callback functions into suspend functions or Flow](<https://devfeed.tech/articles/how-to-turn-callback-functions-into-suspend-functions-or-flow-39322.md>)

Original publisher: [Read original article](<https://kt.academy/article/interop-callbacks-to-coroutines>)

Published: 2025-07-14T00:00:00Z

Content type: tutorial

Language: en

Sources: [Kt. Academy](<https://devfeed.tech/sources/kt-academy.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [kotlin-coroutines](<https://devfeed.tech/topics/kotlin-coroutines.md>), [callback](<https://devfeed.tech/topics/callback.md>), [functions](<https://devfeed.tech/topics/functions.md>), [Continuation](<https://devfeed.tech/topics/continuation.md>), [API](<https://devfeed.tech/topics/api.md>)

Tags: [callback](<https://devfeed.tech/tags/callback.md>), [cancellation](<https://devfeed.tech/tags/cancellation.md>), [continuation](<https://devfeed.tech/tags/continuation.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [functions](<https://devfeed.tech/tags/functions.md>), [guide](<https://devfeed.tech/tags/guide.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [interoperability](<https://devfeed.tech/tags/interoperability.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-coroutines](<https://devfeed.tech/tags/kotlin-coroutines.md>), [suspend](<https://devfeed.tech/tags/suspend.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

A guide to adapting callback-based APIs for Kotlin Coroutines. It explains how to convert callbacks that return one value into suspending functions and how to adapt callbacks that emit multiple values into Flows, including handling cancellation and exceptions.

### Source excerpt

A guide on how to correctly convert callback-based functions into suspending functions or Flows in Kotlin Coroutines.

## Concurrent Programming in Kotlin: Ensuring Thread Safety with Mutex

DevFeed: [Concurrent Programming in Kotlin: Ensuring Thread Safety with Mutex](<https://devfeed.tech/articles/concurrent-programming-in-kotlin-ensuring-thread-safety-with-mutex-23873.md>)

Original publisher: [Read original article](<https://engineering.premise.com/concurrent-programming-in-kotlin-ensuring-thread-safety-with-mutex-5d9c6b80644b?source=rss----c5fada0a103d---4>)

Author: Kwabena Bio Berko

Published: 2023-07-18T03:33:24Z

Content type: tutorial

Language: en

Sources: [Engineering at Premise - Medium](<https://devfeed.tech/sources/engineering-at-premise-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Concurrent Programming](<https://devfeed.tech/topics/concurrent-programming.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [Database](<https://devfeed.tech/topics/database.md>), [Software Engineering](<https://devfeed.tech/topics/software-engineering.md>)

Tags: [atomic](<https://devfeed.tech/tags/atomic.md>), [code](<https://devfeed.tech/tags/code.md>), [component](<https://devfeed.tech/tags/component.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [concurrent](<https://devfeed.tech/tags/concurrent.md>), [concurrent-programming](<https://devfeed.tech/tags/concurrent-programming.md>), [coroutine](<https://devfeed.tech/tags/coroutine.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [data](<https://devfeed.tech/tags/data.md>), [database](<https://devfeed.tech/tags/database.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [function](<https://devfeed.tech/tags/function.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [io](<https://devfeed.tech/tags/io.md>), [issue](<https://devfeed.tech/tags/issue.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [let](<https://devfeed.tech/tags/let.md>), [mobile-app-development](<https://devfeed.tech/tags/mobile-app-development.md>), [mutex](<https://devfeed.tech/tags/mutex.md>), [safety](<https://devfeed.tech/tags/safety.md>), [suspend](<https://devfeed.tech/tags/suspend.md>), [thread](<https://devfeed.tech/tags/thread.md>)

### AI overview

This Kotlin tutorial explains how Mutex provides mutual exclusion when multiple threads or coroutines call a refresh function. It shows how locking can prevent duplicate network and database operations, avoid race conditions, and preserve atomicity, while withLock can suspend callers until the current lock is released.

### Source excerpt

By Kwabena Bio Berko, Android Engineer Photo by Chris Ried on Unsplash I have recently been experimenting with mutual exclusion(Mutex), a concept in software engineering to solve race conditions when accessing shared resources. Let's assume we have a component with a refresh function that can be accessed from multiple threads or coroutines: https://medium.com/media/e19aa2a9d57bc105b841d28061a199b8/href In the implementation of this component, the function retrieves data from a remote resource and inserts it into the local database. However, these operations need to be atomic. Now, imagine if 10 threads call this function simultaneously, or even a few milliseconds apart. What happens? If you guessed that we make 10 network calls and 10 database IO operations to save the items, then you would be right, as confirmed by the below test: https://medium.com/media/9b279658dbf87021068ee21a913dc80e/hrefhttps://medium.com/media/81cdc164ad807fd45df77389c00bd4cc/href But that's not what we want. It's definitely not resource-friendly. To address this issue, we can use a Mutex. As the name suggests, a Mutex provides mutual exclusion for a specific portion of your code, imposing restrictions on the access to that portion in situations where multiple threads or coroutines may attempt to access it concurrently. In essence, Mutex allows only one thread or coroutine to work within the confines of that portion of the code at any given time. By introducing a Mutex in our refresh function, we can ensure that only one thread is executing the critical sections of the code, preventing race conditions and ensuring atomicity of the operations. https://medium.com/media/9d88a802b4c73f14ceb4d5527158af5d/href In the example above, whenever the refresh function is called, we check to see if the Mutex is already locked or been used. If not, we lock it and then perform our network call and save the results in our local database. This means that whenever another thread or coroutine calls this refresh

## Flow testing with Turbine

DevFeed: [Flow testing with Turbine](<https://devfeed.tech/articles/flow-testing-with-turbine-20886.md>)

Original publisher: [Read original article](<https://code.cash.app/flow-testing-with-turbine>)

Author: Jake Wharton

Published: 2023-06-21T00:00:00Z

Content type: tutorial

Language: en

Sources: [Jake Wharton](<https://devfeed.tech/sources/jake-wharton.md>)

Topics: [Testing](<https://devfeed.tech/topics/testing.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [Library](<https://devfeed.tech/topics/library.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Kotlin Multiplatform](<https://devfeed.tech/topics/kotlin-multiplatform.md>)

Tags: [coroutines](<https://devfeed.tech/tags/coroutines.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [library](<https://devfeed.tech/tags/library.md>), [multiplatform](<https://devfeed.tech/tags/multiplatform.md>), [skip](<https://devfeed.tech/tags/skip.md>), [suspend](<https://devfeed.tech/tags/suspend.md>), [test](<https://devfeed.tech/tags/test.md>), [testing](<https://devfeed.tech/tags/testing.md>), [timeout](<https://devfeed.tech/tags/timeout.md>)

### AI overview

Cash App introduces Turbine 1.0, a library for testing Kotlin kotlinx.coroutines Flow by converting push-based streams into pull-based suspend functions. Turbine suspends while waiting for events and fails tests when unexpected events or timeouts occur. It also supports error handling, skipping items, cancellation, standalone adapters for callbacks, and utilities for testing multiple streams.

### Source excerpt

This post was published externally on Cash App Code Blog. Read it at https://code.cash.app/flow-testing-with-turbine.

## Animation in Jetpack Compose

DevFeed: [Animation in Jetpack Compose](<https://devfeed.tech/articles/animation-in-jetpack-compose-22648.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/animation-compose-api-summary>)

Author: James Shvarts

Published: 2022-07-01T04:00:00Z

Content type: tutorial

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Compose](<https://devfeed.tech/topics/compose.md>), [API](<https://devfeed.tech/topics/api.md>), [Android](<https://devfeed.tech/topics/android.md>), [Android Studio](<https://devfeed.tech/topics/android-studio.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-studio](<https://devfeed.tech/tags/android-studio.md>), [animation](<https://devfeed.tech/tags/animation.md>), [api](<https://devfeed.tech/tags/api.md>), [code](<https://devfeed.tech/tags/code.md>), [compose](<https://devfeed.tech/tags/compose.md>), [compose-animation](<https://devfeed.tech/tags/compose-animation.md>), [debug](<https://devfeed.tech/tags/debug.md>), [declarative](<https://devfeed.tech/tags/declarative.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [layout](<https://devfeed.tech/tags/layout.md>), [state](<https://devfeed.tech/tags/state.md>), [suspend](<https://devfeed.tech/tags/suspend.md>), [tooling](<https://devfeed.tech/tags/tooling.md>)

### AI overview

A foundational overview of Jetpack Compose Animation APIs, organized around animation scenarios and API selection. It covers declarative and state-based APIs, customization, coroutine-based lower-level APIs, and Android Studio tooling for implementation and debugging.

### Source excerpt

Foundational overview of Compose Animation APIs to help you choose most suitable API for your animation task.

## Building applications with Kotlin and Arrow.kt in style

DevFeed: [Building applications with Kotlin and Arrow.kt in style](<https://devfeed.tech/articles/building-applications-with-kotlin-and-arrow-kt-in-style-25510.md>)

Original publisher: [Read original article](<http://nomisrev.github.io/building-applications-with-kotlin-and-arrow.kt-in-style/>)

Author: Simon Vergauwen

Published: 2022-05-31T00:00:00Z

Content type: tutorial

Language: en

Sources: [nomisRev](<https://devfeed.tech/sources/nomisrev.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Ktor](<https://devfeed.tech/topics/ktor.md>), [Functional programming](<https://devfeed.tech/topics/functional-programming.md>), [Microservices](<https://devfeed.tech/topics/microservices.md>), [Architecture & Design](<https://devfeed.tech/topics/architecture-design.md>)

Tags: [arrow](<https://devfeed.tech/tags/arrow.md>), [continuation](<https://devfeed.tech/tags/continuation.md>), [database](<https://devfeed.tech/tags/database.md>), [effect](<https://devfeed.tech/tags/effect.md>), [either](<https://devfeed.tech/tags/either.md>), [functional-programming](<https://devfeed.tech/tags/functional-programming.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [ktor](<https://devfeed.tech/tags/ktor.md>), [microservices](<https://devfeed.tech/tags/microservices.md>), [suspend](<https://devfeed.tech/tags/suspend.md>), [webinar](<https://devfeed.tech/tags/webinar.md>)

### AI overview

A webinar with Anton Arhipov demonstrates an end-to-end functional microservices workflow using Kotlin, Ktor, and Arrow, including request handling, database interaction, and response generation.

### Source excerpt

Webinar with Anton Arhipov on functional microservices with Ktor and Arrow.

## Exploring Kotlin's Context Receivers

DevFeed: [Exploring Kotlin's Context Receivers](<https://devfeed.tech/articles/exploring-kotlin-s-context-receivers-25511.md>)

Original publisher: [Read original article](<http://nomisrev.github.io/context-receivers/>)

Author: Simon Vergauwen

Published: 2022-02-17T00:00:00Z

Content type: article

Language: en

Sources: [nomisRev](<https://devfeed.tech/sources/nomisrev.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [ide](<https://devfeed.tech/topics/ide.md>), [context](<https://devfeed.tech/topics/context.md>)

Tags: [compiler](<https://devfeed.tech/tags/compiler.md>), [dsl](<https://devfeed.tech/tags/dsl.md>), [effect](<https://devfeed.tech/tags/effect.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [fp](<https://devfeed.tech/tags/fp.md>), [function](<https://devfeed.tech/tags/function.md>), [ide](<https://devfeed.tech/tags/ide.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [scope-functions](<https://devfeed.tech/tags/scope-functions.md>), [suspend](<https://devfeed.tech/tags/suspend.md>)

### AI overview

A tutorial on Kotlin Context Receivers, introduced as a preview in Kotlin 1.6.20-M1. It explains how additional receivers work, how the compiler handles them, and how they can support scope-based programming patterns such as effect handlers and logging contexts.

### Source excerpt

Last week a long awaited feature was released as a preview in Kotlin 1.6.20-M1. In this blogpost we're going to explore what Context Receivers are, and some benefits and patterns they'll enable. To try it out in your IDE, follow this guide

## Kotlin's inline and suspend features

DevFeed: [Kotlin's inline and suspend features](<https://devfeed.tech/articles/my-favorite-kotlin-feature-25517.md>)

Original publisher: [Read original article](<http://nomisrev.github.io/inline-and-suspend/>)

Author: Simon Vergauwen

Published: 2022-01-18T00:00:00Z

Content type: article

Language: en

Sources: [nomisRev](<https://devfeed.tech/sources/nomisrev.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [inlining](<https://devfeed.tech/topics/inlining.md>), [async](<https://devfeed.tech/topics/async.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>)

Tags: [async](<https://devfeed.tech/tags/async.md>), [callback](<https://devfeed.tech/tags/callback.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [continuation](<https://devfeed.tech/tags/continuation.md>), [dsl](<https://devfeed.tech/tags/dsl.md>), [function](<https://devfeed.tech/tags/function.md>), [hof](<https://devfeed.tech/tags/hof.md>), [inlining](<https://devfeed.tech/tags/inlining.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [suspend](<https://devfeed.tech/tags/suspend.md>)

### AI overview

This article explains Kotlin's inline feature and suspend functions, focusing on how their combination supports efficient higher-order functions and imperative code for asynchronous workflows. It also describes compiler checks for suspending calls.

### Source excerpt

Over the last several years I've seen many discussions on Kotlin's features. Nullability is always a very high ranked one. I like it, but it's definitely not my favorite feature.

## Functional programming in Kotlin with Arrow.kt

DevFeed: [Functional programming in Kotlin with Arrow.kt](<https://devfeed.tech/articles/functional-programming-in-kotlin-with-arrow-kt-25514.md>)

Original publisher: [Read original article](<http://nomisrev.github.io/functional-programming-in-kotlin-with-arrow-kt/>)

Author: Simon Vergauwen

Published: 2021-12-05T00:00:00Z

Content type: article

Language: en

Sources: [nomisRev](<https://devfeed.tech/sources/nomisrev.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Functional programming](<https://devfeed.tech/topics/functional-programming.md>), [Ktor](<https://devfeed.tech/topics/ktor.md>), [Microservice](<https://devfeed.tech/topics/microservice.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [circuit](<https://devfeed.tech/tags/circuit.md>), [effect](<https://devfeed.tech/tags/effect.md>), [either](<https://devfeed.tech/tags/either.md>), [functional-programming](<https://devfeed.tech/tags/functional-programming.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [ktor](<https://devfeed.tech/tags/ktor.md>), [microservices](<https://devfeed.tech/tags/microservices.md>), [patterns](<https://devfeed.tech/tags/patterns.md>), [programming](<https://devfeed.tech/tags/programming.md>), [suspend](<https://devfeed.tech/tags/suspend.md>), [validation](<https://devfeed.tech/tags/validation.md>), [webinar](<https://devfeed.tech/tags/webinar.md>)

### AI overview

A webinar discusses functional microservices with Ktor and Arrow in Kotlin, including retries with circuit breakers and schedulers, validation, optics, and analysis.

### Source excerpt

Webinar with Anton Arhipov & Alejandro Serrano about functional microservices with Ktor and Arrow.

## Codename One Announces Higher Prices for New Paid-Plan Subscribers Starting January 1, 2022

DevFeed: [Codename One Announces Higher Prices for New Paid-Plan Subscribers Starting January 1, 2022](<https://devfeed.tech/articles/we-re-raising-prices-here-s-how-you-can-keep-the-old-price-19668.md>)

Original publisher: [Read original article](<https://www.codenameone.com/blog/we-are-raising-prices/>)

Author: Shai Almog

Published: 2021-11-05T00:00:00Z

Content type: article

Language: en

Sources: [CodeName One](<https://devfeed.tech/sources/codename-one.md>)

Topics: [hosting](<https://devfeed.tech/topics/hosting.md>)

Tags: [account](<https://devfeed.tech/tags/account.md>), [free](<https://devfeed.tech/tags/free.md>), [pricing](<https://devfeed.tech/tags/pricing.md>), [signing](<https://devfeed.tech/tags/signing.md>), [subscription](<https://devfeed.tech/tags/subscription.md>), [suspend](<https://devfeed.tech/tags/suspend.md>), [upgrade](<https://devfeed.tech/tags/upgrade.md>)

### AI overview

Codename One announces higher prices for users who sign up for paid plans after December 31, 2021. Existing subscribers who retain their accounts keep their current renewal prices, while free plans remain unaffected.

### Source excerpt

We're adjusting pricing for paid plans for new users signing up after December 31st, 2021. Learn how you can keep the old price.

## How does suspension work in Kotlin coroutines?

DevFeed: [How does suspension work in Kotlin coroutines?](<https://devfeed.tech/articles/how-does-suspension-work-in-kotlin-coroutines-39239.md>)

Original publisher: [Read original article](<https://kt.academy/article/cc-suspension>)

Published: 2021-07-28T00:00:00Z

Content type: tutorial

Language: en

Sources: [Kt. Academy](<https://devfeed.tech/sources/kt-academy.md>)

Topics: [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [kotlin-coroutines](<https://devfeed.tech/topics/kotlin-coroutines.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Concurrent Programming](<https://devfeed.tech/topics/concurrent-programming.md>)

Tags: [backend](<https://devfeed.tech/tags/backend.md>), [blocking](<https://devfeed.tech/tags/blocking.md>), [concurrently](<https://devfeed.tech/tags/concurrently.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-coroutines](<https://devfeed.tech/tags/kotlin-coroutines.md>), [suspend](<https://devfeed.tech/tags/suspend.md>), [thread](<https://devfeed.tech/tags/thread.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

This tutorial explains how suspension works in Kotlin coroutines. It contrasts coroutine suspension with thread blocking, describes how suspended coroutines retain their state while using fewer resources, and introduces suspending functions and their role in suspending coroutines.

### Source excerpt

A deep explanation of how suspension works in Kotlin Coroutines.

## Kotlin Coroutines and Swift, revisited - Russell Wolf

DevFeed: [Kotlin Coroutines and Swift, revisited - Russell Wolf](<https://devfeed.tech/articles/kotlin-coroutines-and-swift-revisited-russell-wolf-38261.md>)

Original publisher: [Read original article](<https://touchlab.co/kotlin-coroutines-swift-revisited>)

Published: 2021-05-28T18:42:45Z

Content type: tutorial

Language: en

Sources: [Touchlab | Enterprise Mobile Innovation & Development](<https://devfeed.tech/sources/touchlab-enterprise-mobile-innovation-development.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [kotlin-coroutines](<https://devfeed.tech/topics/kotlin-coroutines.md>), [Swift](<https://devfeed.tech/topics/swift.md>), [iOS](<https://devfeed.tech/topics/ios.md>), [Mobile](<https://devfeed.tech/topics/mobile.md>), [reactive](<https://devfeed.tech/topics/reactive.md>), [Framework](<https://devfeed.tech/topics/framework.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [article](<https://devfeed.tech/tags/article.md>), [class](<https://devfeed.tech/tags/class.md>), [classes](<https://devfeed.tech/tags/classes.md>), [code-generation](<https://devfeed.tech/tags/code-generation.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [error](<https://devfeed.tech/tags/error.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [internals](<https://devfeed.tech/tags/internals.md>), [interop](<https://devfeed.tech/tags/interop.md>), [ios](<https://devfeed.tech/tags/ios.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-coroutines](<https://devfeed.tech/tags/kotlin-coroutines.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [mobile](<https://devfeed.tech/tags/mobile.md>), [patterns](<https://devfeed.tech/tags/patterns.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [stream](<https://devfeed.tech/tags/stream.md>), [suspend](<https://devfeed.tech/tags/suspend.md>), [swift](<https://devfeed.tech/tags/swift.md>)

### AI overview

Russell Wolf revisits patterns for exposing Kotlin coroutine-based repository code to iOS. The article recommends managing coroutine scope in Kotlin, adding a Swift wrapper to hide Kotlin implementation details, and adapting callback events for RxSwift and Combine.

### Source excerpt

An update on patterns for interop between Kotlin coroutines and RxSwift from Russell Wolf, engineer at Touchlab (Kotlin Multipaltform Mobile experts).

## Tracking side effects at compile time with suspend

DevFeed: [Tracking side effects at compile time with suspend](<https://devfeed.tech/articles/tracking-side-effects-at-compile-time-with-suspend-27471.md>)

Original publisher: [Read original article](<https://jorgecastilloprz.github.io/tracking-side-effects-with-suspend>)

Author: Jorge Castillo

Published: 2020-10-10T10:00:00Z

Content type: article

Language: en

Sources: [👨💻 Jorge Castillo](<https://devfeed.tech/sources/jorge-castillo.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Functional programming](<https://devfeed.tech/topics/functional-programming.md>), [Declarative programming](<https://devfeed.tech/topics/declarative-programming.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>)

Tags: [all-kotlin-posts-including-the-fp-ones](<https://devfeed.tech/tags/all-kotlin-posts-including-the-fp-ones.md>), [android](<https://devfeed.tech/tags/android.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [compose](<https://devfeed.tech/tags/compose.md>), [coroutine](<https://devfeed.tech/tags/coroutine.md>), [declarative](<https://devfeed.tech/tags/declarative.md>), [functional-programming](<https://devfeed.tech/tags/functional-programming.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [suspend](<https://devfeed.tech/tags/suspend.md>)

### AI overview

The article explains suspend as a Kotlin standard-library mechanism that makes effects visible to the compiler and restricts them to coroutine environments prepared to execute those effects. It relates this model to deferred execution in Kotlin Sequences and runtime interpretation and optimization in Jetpack Compose.

### Source excerpt

Thinking of suspend as a Kotlin stdlib mechanism for flagging and tracking effects at compile time.

## Kotlin Continuations

DevFeed: [Kotlin Continuations](<https://devfeed.tech/articles/kotlin-continuations-27465.md>)

Original publisher: [Read original article](<https://jorgecastilloprz.github.io/digging-into-kotlin-continuations>)

Author: Jorge Castillo

Published: 2020-09-03T11:00:00Z

Content type: tutorial

Language: en

Sources: [👨💻 Jorge Castillo](<https://devfeed.tech/sources/jorge-castillo.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>)

Tags: [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [callback](<https://devfeed.tech/tags/callback.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [continuation](<https://devfeed.tech/tags/continuation.md>), [coroutine](<https://devfeed.tech/tags/coroutine.md>), [exception](<https://devfeed.tech/tags/exception.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [standard-library](<https://devfeed.tech/tags/standard-library.md>), [suspend](<https://devfeed.tech/tags/suspend.md>)

### AI overview

This article explains Kotlin continuations as a form of control flow and describes how the Kotlin compiler transforms suspend functions into continuation-passing, callback-style code. It also covers continuation contracts, coroutine resumption, and when manually creating continuations may be useful.

### Source excerpt

Continuations represent the rest of a program. They are a form of control flow.

## Working with Kotlin Coroutines and RxSwift

DevFeed: [Working with Kotlin Coroutines and RxSwift](<https://devfeed.tech/articles/working-with-kotlin-coroutines-and-rxswift-25005.md>)

Original publisher: [Read original article](<https://dev.to/touchlab/working-with-kotlin-coroutines-and-rxswift-24fa>)

Author: Russell Wolf

Published: 2020-06-15T19:07:18Z

Content type: tutorial

Language: en

Sources: [DEV Community 👩💻👨💻: Russell Wolf](<https://devfeed.tech/sources/dev-community-russell-wolf.md>)

Topics: [kotlin-coroutines](<https://devfeed.tech/topics/kotlin-coroutines.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Swift](<https://devfeed.tech/topics/swift.md>), [iOS](<https://devfeed.tech/topics/ios.md>), [reactive](<https://devfeed.tech/topics/reactive.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [coding](<https://devfeed.tech/tags/coding.md>), [community](<https://devfeed.tech/tags/community.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [development](<https://devfeed.tech/tags/development.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [flow](<https://devfeed.tech/tags/flow.md>), [inclusive](<https://devfeed.tech/tags/inclusive.md>), [interop](<https://devfeed.tech/tags/interop.md>), [ios](<https://devfeed.tech/tags/ios.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-coroutines](<https://devfeed.tech/tags/kotlin-coroutines.md>), [kotlinmultiplatform](<https://devfeed.tech/tags/kotlinmultiplatform.md>), [memory-leaks](<https://devfeed.tech/tags/memory-leaks.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [reactive-streams](<https://devfeed.tech/tags/reactive-streams.md>), [software](<https://devfeed.tech/tags/software.md>), [suspend](<https://devfeed.tech/tags/suspend.md>), [swift](<https://devfeed.tech/tags/swift.md>)

### AI overview

This tutorial explains interoperability between Kotlin coroutines in shared code and RxSwift on iOS. It describes coroutine limitations on Kotlin/Native, including single-threaded release use and experimental multithreading risks, and discusses Swift and Objective-C interop constraints. Example repository code demonstrates single-event and stream operations, success and error cases, and cancellation.

### Source excerpt

A recent client engagement involved interop between Kotlin coroutines in shared code, and RxSwift on the iOS side. We did some work to ensure that this could be done in a way that is type-safe and thread-safe. Whether or not you use RxSwift, hopefully this can provide some useful patterns for interop code. Coroutines are a Kotlin language feature that allows asynchronous code to be written in a way that looks like synchronous code, avoiding the nesting that often comes with callback-based APIs. They're available on all Kotlin platforms, but have some limitations on the native side. The release version of native coroutines is limited to single-threaded use-cases, though there are experimental releases available that are multithreaded with some risk of memory leaks. But while they're a fully-supported language feature of Kotlin, they don't translate to Objective-C and Swift. RxSwift is a Swift implementation of the Reactive Streams specification. It's one way to handle asynchronous code on Swift, and has many operators for combining and transforming event streams. Though some of the names are different, much of the API will feel familiar to Kotlin developers who have experience with RxJava. Since Coroutines will almost always be present in shared code, and RxSwift is a common option on the iOS side, hopefully the motivation to communicate between them is clear. So let's start writing some code. Common Repository We'll work with a dummy repository class that looks like this, defined in src/commonMain class ThingRepository { suspend fun getThing(succeed: Boolean): Thing { delay(100) if (succeed) { return Thing(0) } else { error("oh no!") } } fun getThingStream(count: Int, succeed: Boolean): Flow<Thing> = flow { repeat(count) { delay(100) emit(Thing(it)) } if (!succeed) error("oops!") } } From the outside this looks roughly like a real repository might, but with inputs that let us control the output a bit more directly for demonstration purposes. It gives us the ability

## Interoperation between RxJava and Kotlin Coroutines

DevFeed: [Interoperation between RxJava and Kotlin Coroutines](<https://devfeed.tech/articles/interoperation-between-rxjava-and-kotlin-coroutines-24806.md>)

Original publisher: [Read original article](<https://akarnokd.blogspot.com/2017/09/interoperation-between-rxjava-and.html>)

Author: David Karnok (noreply@blogger.com)

Published: 2017-09-11T21:29:00Z

Content type: tutorial

Language: en

Sources: [Akarnokd - Advanced RxJava](<https://devfeed.tech/sources/akarnokd-advanced-rxjava.md>)

Topics: [kotlin-coroutines](<https://devfeed.tech/topics/kotlin-coroutines.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Code](<https://devfeed.tech/topics/code.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>)

Tags: [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [await](<https://devfeed.tech/tags/await.md>), [backpressure](<https://devfeed.tech/tags/backpressure.md>), [channel](<https://devfeed.tech/tags/channel.md>), [code](<https://devfeed.tech/tags/code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [flow](<https://devfeed.tech/tags/flow.md>), [flowable](<https://devfeed.tech/tags/flowable.md>), [flowablesubscriber](<https://devfeed.tech/tags/flowablesubscriber.md>), [interoperation](<https://devfeed.tech/tags/interoperation.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-coroutines](<https://devfeed.tech/tags/kotlin-coroutines.md>), [notify](<https://devfeed.tech/tags/notify.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>), [stream](<https://devfeed.tech/tags/stream.md>), [subscription](<https://devfeed.tech/tags/subscription.md>), [suspend](<https://devfeed.tech/tags/suspend.md>)

### AI overview

This tutorial explains how to make RxJava work with Kotlin Coroutines. It introduces a suspendable emitter and a coroutine-based Flowable generator that can suspend emission until downstream demand is available.

### Source excerpt

Introduction Writing imperative-looking code with Kotlin Coroutines is certainly an attractive property of it, but I'd think things can get quite convoluted pretty fast once, for example, Selectors are involved. I haven't gotten there to look at what Selectors are, I only read that they can help you implement a flatMap like stream combiner. We are not goind to do that now, RxJava can do it for us after all. However, the reasonable question arises: if I have a coroutine generator, a coroutine transformation or simply want to receive items from a Flowable, how can I make RxJava work with these coroutines? Easily with the combined magic of Kotlin Coroutines and RxJava coroutines! Suspendable Emitter A generator is a source-like construct that emits items followed by a terminal signal. It should be familiar from RxJava as the Flowable.generate() operator. It gives you a FlowableEmitter and the usual onNext, onError and onComplete calls on it. One limitation is that you can call onNext only once per invocation of your (Bi)Consumer lambda that receives the emitter. The reason is that we can't block a second call to onNext and we don't want to buffer it either; therefore, RxJava cooperates with the developer. Compiler supported suspension and state machine built by it, however, allow us to prevent a second call from getting through by suspending it until there is a demand from the downstream, which then resumes the coroutine where it left off. Therefore, we can lift the single onNext requirement for our Coroutine-based generator. So let's define the SuspendEmitter interface interface SuspendEmitter<in T> : CoroutineScope { suspend fun onNext(t: T) suspend fun onError(t: Throwable) suspend fun onComplete() } By extending the CoroutineScope, we provide useful infrastructure (i.e., coroutineContext, isActive) to the block that will target our SuspendEmitter. One can argue that why use onError and onComplete since a coroutine can throw and simply end. The reason is that this w

## RxJava vs. Kotlin Coroutines, a quick look

DevFeed: [RxJava vs. Kotlin Coroutines, a quick look](<https://devfeed.tech/articles/rxjava-vs-kotlin-coroutines-a-quick-look-24815.md>)

Original publisher: [Read original article](<https://akarnokd.blogspot.com/2017/09/rxjava-vs-kotlin-coroutines-quick-look.html>)

Author: David Karnok (noreply@blogger.com)

Published: 2017-09-05T15:11:00Z

Content type: comparison

Language: en

Sources: [Akarnokd - Advanced RxJava](<https://devfeed.tech/sources/akarnokd-advanced-rxjava.md>)

Topics: [kotlin-coroutines](<https://devfeed.tech/topics/kotlin-coroutines.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [reactive](<https://devfeed.tech/topics/reactive.md>), [Usability](<https://devfeed.tech/topics/usability.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [blocking](<https://devfeed.tech/tags/blocking.md>), [business-logic](<https://devfeed.tech/tags/business-logic.md>), [code](<https://devfeed.tech/tags/code.md>), [coroutine](<https://devfeed.tech/tags/coroutine.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [experimental](<https://devfeed.tech/tags/experimental.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-coroutines](<https://devfeed.tech/tags/kotlin-coroutines.md>), [main-thread](<https://devfeed.tech/tags/main-thread.md>), [programming](<https://devfeed.tech/tags/programming.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [reactive-programming](<https://devfeed.tech/tags/reactive-programming.md>), [retry](<https://devfeed.tech/tags/retry.md>), [runblocking](<https://devfeed.tech/tags/runblocking.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>), [suspend](<https://devfeed.tech/tags/suspend.md>), [thread](<https://devfeed.tech/tags/thread.md>), [timeout](<https://devfeed.tech/tags/timeout.md>), [zip](<https://devfeed.tech/tags/zip.md>)

### AI overview

This article compares RxJava and Kotlin Coroutines through an example involving delayed unreliable services, timeouts, cancellation, retries, and combining results. It emphasizes usability over raw performance and describes coroutine code as more sequential and synchronous-looking, while noting that coroutines were experimental at the time.

### Source excerpt

Introduction Does Kotlin Coroutines make RxJava and reactive programming obsolete? The answer depends on who you ask. Enthusiasts and marketing departments would say yes without hesitation. If so, sooner or later developers would have to convert Rx code into coroutines or write something with coroutines from the start. Since Coroutines are currently experimental, there is always the prospect deficiencies, especially regarding the overhead, will be resolved eventually. Therefore, this post will focus more on usability than raw performance. The scenario Let's say we have two functions imitating unreliable service: f1 and f2, both returning a number after some delay. We have to call these services, sum up their returned values and present it to the user. However, if this doesn't happen within 500 milliseconds, we don't expect it to happen reasonably faster, thus we'd like to cancel and retry the two services for a limited amount of time before giving up after some number of retries. The Coroutine Way Programming via coroutines feels like programming with the traditional ExecutorService- and Future-based toolset with the difference that the underlying infrastructure will use suspension, state machine(s) and task rescheduling instead of blocking a thread. First, we need the functions that exhibit the delaying behavior: suspend fun f1(i: Int) { Thread.sleep(if (i != 2) 2000L else 200L) return 1; } suspend fun f2(i: Int) { Thread.sleep(if (i != 2) 2000L else 200L) return 2; } Functions that participate in a coroutine execution should be declared with the suspend keyword and executed within a coroutine context. For demonstration purposes, the logic will sleep for 2 seconds if the parameter supplied to the functions is not 2. This will give a chance to the timeout logic to kick in yet the 3rd attempt to succeed before the timeout. Since going asynchronous usually ends up leaving the main thread, we need a way to block it until the business logic completes before letting the