scoop:scoop.window:0.1.0
src/owner/native_operations.scoop
Selected production source · src/owner/native_operations.scoop
1
package scoop.window3
/** Use the application callback, after I/O watches have returned and rearmed their sources. */4
internal fun ApplicationOwner.deferNativeOperation(operation: () -> Unit) {5
nativeOperations.add(operation)6
mailbox.wake()7
}9
internal fun ApplicationOwner.drainNativeOperations() {10
if (pumping || dispatchDepth != 0)11
return12
if (nativeOperations.size == 0L)13
return14
val operation = nativeOperations.removeAt(0L)15
nativeOperationDepth += 116
try {17
operation()18
} finally {19
nativeOperationDepth -= 120
mailbox.wake()21
}22
}