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