@@ -42,27 +42,36 @@ public interface EventLoop {
42
42
*/
43
43
public fun processNextEvent (): Long
44
44
45
+ /* * @suppress **Deprecated **/
46
+ @Deprecated(message = " Companion object to be removed, no replacement" )
45
47
public companion object Factory {
46
- /* *
47
- * Creates a new event loop that is bound the specified [thread] (current thread by default) and
48
- * stops accepting new events when [parentJob] completes. Every continuation that is scheduled
49
- * onto this event loop unparks the specified thread via [LockSupport.unpark].
50
- *
51
- * The main event-processing loop using the resulting `eventLoop` object should look like this:
52
- * ```
53
- * while (needsToBeRunning) {
54
- * if (Thread.interrupted()) break // or handle somehow
55
- * LockSupport.parkNanos(eventLoop.processNextEvent()) // event loop will unpark
56
- * }
57
- * ```
58
- */
48
+ /* * @suppress **Deprecated **/
49
+ @Deprecated(" Replaced with top-level function" , level = DeprecationLevel .HIDDEN )
59
50
public operator fun invoke (thread : Thread = Thread .currentThread(), parentJob : Job ? = null): CoroutineDispatcher =
60
51
EventLoopImpl (thread).apply {
61
52
if (parentJob != null ) initParentJob(parentJob)
62
53
}
63
54
}
64
55
}
65
56
57
+ /* *
58
+ * Creates a new event loop that is bound the specified [thread] (current thread by default) and
59
+ * stops accepting new events when [parentJob] completes. Every continuation that is scheduled
60
+ * onto this event loop unparks the specified thread via [LockSupport.unpark].
61
+ *
62
+ * The main event-processing loop using the resulting `eventLoop` object should look like this:
63
+ * ```
64
+ * while (needsToBeRunning) {
65
+ * if (Thread.interrupted()) break // or handle somehow
66
+ * LockSupport.parkNanos(eventLoop.processNextEvent()) // event loop will unpark
67
+ * }
68
+ * ```
69
+ */
70
+ public fun EventLoop (thread : Thread = Thread .currentThread(), parentJob : Job ? = null): CoroutineDispatcher =
71
+ EventLoopImpl (thread).apply {
72
+ if (parentJob != null ) initParentJob(parentJob)
73
+ }
74
+
66
75
private const val DELAYED = 0
67
76
private const val REMOVED = 1
68
77
private const val RESCHEDULED = 2
0 commit comments