Skip to content

Instantly share code, notes, and snippets.

@joeyslalom
joeyslalom / CoroutinesUtils.kt
Last active January 9, 2020 21:57 — forked from jivimberg/CoroutinesUtils.kt
SQS Consumer using Kotlin coroutines and pool of workers.
package com.jivimberg.sqs.published
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.isActive
import kotlinx.coroutines.yield
import java.lang.Thread.currentThread
suspend fun CoroutineScope.repeatUntilCancelled(block: suspend () -> Unit) {
while (isActive) {