Last active
September 18, 2022 13:54
-
-
Save aleksandarzekovic/33ebf258637855204d5cf7d6cbb93345 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal inner class Worker private constructor() : Thread() { | |
... | |
private fun executeTask(task: Task) { | |
val taskMode = task.mode | |
idleReset(taskMode) | |
beforeTask(taskMode) | |
runSafely(task) | |
afterTask(taskMode) | |
} | |
... | |
fun runSafely(task: Task) { | |
try { | |
task.run() | |
} | |
... | |
} | |
} | |
internal abstract class Task( | |
@JvmField var submissionTime: Long, | |
@JvmField var taskContext: TaskContext | |
) : Runnable { | |
constructor() : this(0, NonBlockingContext) | |
inline val mode: Int get() = taskContext.taskMode // TASK_XXX | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment