@@ -53,7 +53,7 @@ internal abstract class EventLoop : CoroutineDispatcher() {
53
53
* (no check for performance reasons, may be added in the future).
54
54
*/
55
55
public open fun processNextEvent (): Long {
56
- val task = popNextTask () ? : return Long .MAX_VALUE
56
+ val task = dequeueNextTask () ? : return Long .MAX_VALUE
57
57
task.run ()
58
58
return nextTime
59
59
}
@@ -67,16 +67,19 @@ internal abstract class EventLoop : CoroutineDispatcher() {
67
67
}
68
68
69
69
public fun processUnconfinedEvent (): Boolean {
70
- val task = popUnconfinedTask () ? : return false
70
+ val task = dequeueUnconfinedTask () ? : return false
71
71
task.run ()
72
72
return true
73
73
}
74
74
75
- public fun popUnconfinedTask (): DispatchedTask <* >? =
75
+ protected fun dequeueUnconfinedTask (): DispatchedTask <* >? =
76
76
unconfinedQueue?.removeFirstOrNull()
77
77
78
- protected open fun popNextTask (onlyUnconfined : Boolean = false): Runnable ? =
79
- popUnconfinedTask()
78
+ /* *
79
+ * Get the next event in this event loop, if there is one.
80
+ */
81
+ protected open fun dequeueNextTask (): Runnable ? =
82
+ dequeueUnconfinedTask()
80
83
81
84
/* *
82
85
* Returns `true` if the invoking `runBlocking(context) { ... }` that was passed this event loop in its context
@@ -258,11 +261,8 @@ internal abstract class EventLoopImplBase: EventLoopImplPlatform(), Delay {
258
261
}
259
262
}
260
263
261
- override fun popNextTask (onlyUnconfined : Boolean ): Runnable ? {
262
- val unconfined = popUnconfinedTask()
263
- if (onlyUnconfined) {
264
- return unconfined
265
- }
264
+ protected override fun dequeueNextTask (): Runnable ? {
265
+ val unconfined = dequeueUnconfinedTask()
266
266
// unconfined events take priority
267
267
if (unconfined != null ) {
268
268
return unconfined
0 commit comments