CoroutineTimings

abstract class CoroutineTimings : AbstractCoroutineContextElement, Runnable

The spigot timings require a reference to the runnable to display the name of timings correctly. Now, Kotlin Coroutines does not allow to directly pass a runnable object, because a single coroutine may consist out of multiple runnables. This class is a workaround coroutine context element, which can be passed along the minecraftDispatcher to display a valid name for the coroutine.

Constructors

CoroutineTimings
Link copied to clipboard
fun CoroutineTimings()

Types

Key
Link copied to clipboard
object Key : CoroutineContext.Key<CoroutineTimings>

Key identifier of the context element.

Functions

fold
Link copied to clipboard
open override fun <R> fold(initial: R, operation: (R, CoroutineContext.Element) -> R): R
get
Link copied to clipboard
open operator override fun <E : CoroutineContext.Element> get(key: CoroutineContext.Key<E>): E?
minusKey
Link copied to clipboard
open override fun minusKey(key: CoroutineContext.Key<*>): CoroutineContext
plus
Link copied to clipboard
open operator fun plus(context: CoroutineContext): CoroutineContext
run
Link copied to clipboard
open override fun run()

When an object implementing interface Runnable is used to create a thread, starting the thread causes the object's run method to be called in that separately executing thread.

Properties

key
Link copied to clipboard
open override val key: CoroutineContext.Key<*>
queue
Link copied to clipboard
var queue: Queue<Runnable>

Multiple tasks can be assigned to a single coroutine. We implement this by a queue.