reactive/kotlinx-coroutines-rx2/src/RxScheduler.kt [132:176]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if (delayMillis <= 0) { toSchedule.run() } else { @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") // do not remove the INVISIBLE_REFERENCE suppression: required in K2 ctx.delay.invokeOnTimeout(delayMillis, toSchedule, ctx).let { handle = it } } return disposable } /** * Implements [CoroutineDispatcher] on top of an arbitrary [Scheduler]. */ public class SchedulerCoroutineDispatcher( /** * Underlying scheduler of current [CoroutineDispatcher]. */ public val scheduler: Scheduler ) : CoroutineDispatcher(), Delay { /** @suppress */ override fun dispatch(context: CoroutineContext, block: Runnable) { scheduler.scheduleDirect(block) } /** @suppress */ override fun scheduleResumeAfterDelay(timeMillis: Long, continuation: CancellableContinuation) { val disposable = scheduler.scheduleDirect({ with(continuation) { resumeUndispatched(Unit) } }, timeMillis, TimeUnit.MILLISECONDS) continuation.disposeOnCancellation(disposable) } /** @suppress */ override fun invokeOnTimeout(timeMillis: Long, block: Runnable, context: CoroutineContext): DisposableHandle { val disposable = scheduler.scheduleDirect(block, timeMillis, TimeUnit.MILLISECONDS) return DisposableHandle { disposable.dispose() } } /** @suppress */ override fun toString(): String = scheduler.toString() /** @suppress */ override fun equals(other: Any?): Boolean = other is SchedulerCoroutineDispatcher && other.scheduler === scheduler /** @suppress */ override fun hashCode(): Int = System.identityHashCode(scheduler) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - reactive/kotlinx-coroutines-rx3/src/RxScheduler.kt [132:176]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if (delayMillis <= 0) { toSchedule.run() } else { @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") // do not remove the INVISIBLE_REFERENCE suppression: required in K2 ctx.delay.invokeOnTimeout(delayMillis, toSchedule, ctx).let { handle = it } } return disposable } /** * Implements [CoroutineDispatcher] on top of an arbitrary [Scheduler]. */ public class SchedulerCoroutineDispatcher( /** * Underlying scheduler of current [CoroutineDispatcher]. */ public val scheduler: Scheduler ) : CoroutineDispatcher(), Delay { /** @suppress */ override fun dispatch(context: CoroutineContext, block: Runnable) { scheduler.scheduleDirect(block) } /** @suppress */ override fun scheduleResumeAfterDelay(timeMillis: Long, continuation: CancellableContinuation) { val disposable = scheduler.scheduleDirect({ with(continuation) { resumeUndispatched(Unit) } }, timeMillis, TimeUnit.MILLISECONDS) continuation.disposeOnCancellation(disposable) } /** @suppress */ override fun invokeOnTimeout(timeMillis: Long, block: Runnable, context: CoroutineContext): DisposableHandle { val disposable = scheduler.scheduleDirect(block, timeMillis, TimeUnit.MILLISECONDS) return DisposableHandle { disposable.dispose() } } /** @suppress */ override fun toString(): String = scheduler.toString() /** @suppress */ override fun equals(other: Any?): Boolean = other is SchedulerCoroutineDispatcher && other.scheduler === scheduler /** @suppress */ override fun hashCode(): Int = System.identityHashCode(scheduler) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -