Fix structured concurrency in Context

This commit is contained in:
Alexander Nozik 2020-04-17 18:31:22 +03:00
parent 7c68fc6e85
commit fb28c854b3

View File

@ -8,10 +8,11 @@ import hep.dataforge.provider.Provider
import hep.dataforge.provider.top import hep.dataforge.provider.top
import hep.dataforge.values.Value import hep.dataforge.values.Value
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.SupervisorJob
import mu.KLogger import mu.KLogger
import mu.KotlinLogging import mu.KotlinLogging
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.jvm.JvmName import kotlin.jvm.JvmName
/** /**
@ -91,8 +92,9 @@ open class Context(
config.action() config.action()
} }
override val coroutineContext: CoroutineContext override val coroutineContext: CoroutineContext = (parent ?: Global).coroutineContext.let { parenContext ->
get() = EmptyCoroutineContext parenContext + SupervisorJob(parenContext[Job])
}
/** /**
* Detach all plugins and terminate context * Detach all plugins and terminate context