Skip to content

Instantly share code, notes, and snippets.

View vemilyus's full-sized avatar
🛰️
Orbiting greatness!

Alex Katlein vemilyus

🛰️
Orbiting greatness!
View GitHub Profile
@vemilyus
vemilyus / ActorState.kt
Created December 30, 2018 14:48
Sample implementation of ActorState with read-write separation
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.ObsoleteCoroutinesApi
import kotlinx.coroutines.channels.actor
import kotlinx.coroutines.isActive
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlin.coroutines.CoroutineContext
interface ActorState<T : Any> : CoroutineScope {