diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2020-03-26 13:55:32 +0100 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2020-03-26 13:55:32 +0100 |
| commit | 620f194c53d950a37f78577f4aacfd7c0c06bb9a (patch) | |
| tree | f5f7ffdce8efdcffb92e158ebbb643ba1a797b23 /odcsim/odcsim-engine-omega/src | |
| parent | f4ee29bb97aed68329e72710dd3049c23f592f25 (diff) | |
| parent | 7eb8177e2278bde2c0f4fad00af6fdd2d632cb5b (diff) | |
Merge branch 'feat/2.x-failures' into '2.x'
Implement basic hardware-level failures
See merge request opendc/opendc-simulator!35
Diffstat (limited to 'odcsim/odcsim-engine-omega/src')
| -rw-r--r-- | odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/OmegaSimulationEngine.kt | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/OmegaSimulationEngine.kt b/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/OmegaSimulationEngine.kt index 4edf94d2..934af293 100644 --- a/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/OmegaSimulationEngine.kt +++ b/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/OmegaSimulationEngine.kt @@ -37,6 +37,7 @@ import kotlin.coroutines.CoroutineContext import kotlin.coroutines.coroutineContext import kotlinx.coroutines.CancellableContinuation import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.CoroutineExceptionHandler import kotlinx.coroutines.CoroutineName import kotlinx.coroutines.Delay import kotlinx.coroutines.DisposableHandle @@ -174,6 +175,10 @@ public class OmegaSimulationEngine(override val name: String) : SimulationEngine } } + private val exceptionHandler = CoroutineExceptionHandler { _, exception -> + log.error("Uncaught exception", exception) + } + // SimulationContext override val key: CoroutineContext.Key<*> = SimulationContext.Key @@ -192,7 +197,7 @@ public class OmegaSimulationEngine(override val name: String) : SimulationEngine override val parent: Domain = parent ?: this @InternalCoroutinesApi - override val coroutineContext: CoroutineContext = this + CoroutineName(name) + dispatcher + job + override val coroutineContext: CoroutineContext = this + CoroutineName(name) + dispatcher + job + exceptionHandler override fun toString(): String = path } |
