Skip to content

Commit 1ae4006

Browse files
committed
RxExecutor.launch lets a user run suspend functions within that executor.
1 parent ea78567 commit 1ae4006

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main/java/com/diffplug/common/rx/RxExecutor.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ import kotlinx.coroutines.launch
3636
class RxExecutor internal constructor(val executor: Executor, val dispatcher: CoroutineDispatcher) :
3737
RxSubscriber {
3838

39+
fun launch(block: suspend CoroutineScope.() -> Unit): Job =
40+
CoroutineScope(Job() + dispatcher).launch(block = block)
41+
3942
interface Has : Executor {
4043
val rxExecutor: RxExecutor
4144
}

0 commit comments

Comments
 (0)