diff options
| author | Dante Niewenhuis <d.niewenhuis@hotmail.com> | 2024-03-05 13:23:57 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-05 13:23:57 +0100 |
| commit | 5864cbcbfe2eb8c36ca05c3a39c7e5916aeecaec (patch) | |
| tree | 5b2773b8dc21c2e1b526fb70f829c376dd80532a /opendc-common/src/main/kotlin/org | |
| parent | d28002a3c151d198298574312f32f1cb43f3a660 (diff) | |
Updated package versions, updated web server tests. (#207)
* Updated all package versions including kotlin. Updated all web-server tests to run.
* Changed the java version of the tests. OpenDC now only supports java 19.
* small update
* test update
* new update
* updated docker version to 19
* updated docker version to 19
Diffstat (limited to 'opendc-common/src/main/kotlin/org')
| -rw-r--r-- | opendc-common/src/main/kotlin/org/opendc/common/DispatcherCoroutineDispatcher.kt | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/opendc-common/src/main/kotlin/org/opendc/common/DispatcherCoroutineDispatcher.kt b/opendc-common/src/main/kotlin/org/opendc/common/DispatcherCoroutineDispatcher.kt index 63744ef9..d33e370d 100644 --- a/opendc-common/src/main/kotlin/org/opendc/common/DispatcherCoroutineDispatcher.kt +++ b/opendc-common/src/main/kotlin/org/opendc/common/DispatcherCoroutineDispatcher.kt @@ -37,20 +37,33 @@ import kotlin.coroutines.CoroutineContext */ @OptIn(InternalCoroutinesApi::class) internal class DispatcherCoroutineDispatcher(private val dispatcher: Dispatcher) : CoroutineDispatcher(), Delay, DispatcherProvider { - override fun dispatch(context: CoroutineContext, block: Runnable) { + override fun dispatch( + context: CoroutineContext, + block: Runnable, + ) { block.run() } - override fun dispatchYield(context: CoroutineContext, block: Runnable) { + override fun dispatchYield( + context: CoroutineContext, + block: Runnable, + ) { dispatcher.schedule(block) } @OptIn(ExperimentalCoroutinesApi::class) - override fun scheduleResumeAfterDelay(timeMillis: Long, continuation: CancellableContinuation<Unit>) { + override fun scheduleResumeAfterDelay( + timeMillis: Long, + continuation: CancellableContinuation<Unit>, + ) { dispatcher.schedule(timeMillis, CancellableContinuationRunnable(continuation) { resumeUndispatched(Unit) }) } - override fun invokeOnTimeout(timeMillis: Long, block: Runnable, context: CoroutineContext): DisposableHandle { + override fun invokeOnTimeout( + timeMillis: Long, + block: Runnable, + context: CoroutineContext, + ): DisposableHandle { val handle = dispatcher.scheduleCancellable(timeMillis, block) return DisposableHandle { handle.cancel() } } @@ -67,7 +80,7 @@ internal class DispatcherCoroutineDispatcher(private val dispatcher: Dispatcher) */ private class CancellableContinuationRunnable<T>( @JvmField val continuation: CancellableContinuation<T>, - private val block: CancellableContinuation<T>.() -> Unit + private val block: CancellableContinuation<T>.() -> Unit, ) : Runnable { override fun run() = continuation.block() } |
