Scoop API

scoop:scoop.asyncio:0.1.0

src/loop/host/host.scoop

Selected production source · src/loop/host/host.scoop

1package scoop.asyncio.host
3/** A borrowed platform notification. The event loop owns its state and lifetime. */
4public enum EventLoopNotification {
5 ReadableDescriptor(Int), WindowsEvent(Ptr<Unit>)
6}
8/** Owner-thread, serial notifications from an external main loop. */
9public interface EventLoopHost {
10 /** Whether this caller is the host thread that will deliver notifications. */
11 public fun isCurrentThread(): Boolean
12 /** Borrows without consuming or resetting. Never calls ready inline or retains a failed watch. */
13 @Unsafe public fun watch(notification: EventLoopNotification, ready: () -> Unit): EventLoopWatch
16/** An installed watch. It never owns or consumes the watched resource. */
17public interface EventLoopWatch {
18 /** Does not throw. Calls onRemoved once, after all ready invocations have returned. */
19 public fun remove(onRemoved: () -> Unit)