Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/wasi-common/src/tokio/sched/windows.rs
2465 views
1
use crate::sync::sched::windows::poll_oneoff_;
2
use crate::tokio::block_on_dummy_executor;
3
use crate::{Error, file::WasiFile, sched::Poll};
4
5
pub async fn poll_oneoff<'a>(poll: &mut Poll<'a>) -> Result<(), Error> {
6
// Tokio doesn't provide us the AsyncFd primitive on Windows, so instead
7
// we use the blocking poll_oneoff implementation from the wasi_common::sync impl.
8
// We provide a function specific to this impl's WasiFile types for downcasting
9
// to a RawHandle.
10
block_on_dummy_executor(move || poll_oneoff_(poll, wasi_file_is_stdin))
11
}
12
13
pub fn wasi_file_is_stdin(f: &dyn WasiFile) -> bool {
14
f.as_any().is::<crate::tokio::stdio::Stdin>()
15
}
16
17