Debian Codegraph @

.cargo/vendor/rustix/src/backend/libc/event/windows_syscalls.rs

raw
1 //! Windows system calls in the `event` module.
2
3 use crate::backend::c;
4 use crate::backend::conv::ret_c_int;
5 use crate::event::PollFd;
6 use crate::io;
7
8 pub(crate) fn poll(fds: &mut [PollFd<'_>], timeout: c::c_int) -> io::Result<usize> {
9 let nfds = fds
10 .len()
11 .try_into()
12 .map_err(|_convert_err| io::Errno::INVAL)?;
13
14 ret_c_int(unsafe { c::poll(fds.as_mut_ptr().cast(), nfds, timeout) })
15 .map(|nready| nready as usize)
16 }