scoop:scoop.window.asyncio:0.1.0
src/host.scoop
Selected production source · src/host.scoop
1
package scoop.window.asyncio3
import scoop.asyncio.host.*4
import scoop.window.native.*6
/** Adapts the application's actual native host to the asyncio notification contract. */7
public class WindowLoopHost public constructor(private val host: ApplicationHost): EventLoopHost {8
public override fun isCurrentThread(): Boolean = host.isCurrentThread()9
/** Installs a borrowed platform notification without an inline ready callback. */10
@Unsafe11
public override fun watch(12
notification: EventLoopNotification,13
ready: () -> Unit14
): EventLoopWatch {15
return WindowLoopWatch(platformWatch(host, notification, ready))16
}17
}19
private class WindowLoopWatch(private val watch: ApplicationWatch): EventLoopWatch {20
public override fun remove(onRemoved: () -> Unit) {21
watch.remove(onRemoved)22
}23
}