mirror of https://github.com/smol-rs/polling
Add error message for Wepoll (#54)
* Add error message for Wepoll * Avoid unsupported error kind where it is not supported
This commit is contained in:
parent
0b45549097
commit
00e7eefc4d
4
build.rs
4
build.rs
|
@ -18,4 +18,8 @@ fn main() {
|
|||
if !cfg.probe_rustc_version(1, 63) {
|
||||
autocfg::emit("polling_no_io_safety");
|
||||
}
|
||||
|
||||
if !cfg.probe_rustc_version(1, 53) {
|
||||
autocfg::emit("polling_no_unsupported_error_kind");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,16 @@ impl Poller {
|
|||
pub fn new() -> io::Result<Poller> {
|
||||
let handle = unsafe { we::epoll_create1(0) };
|
||||
if handle.is_null() {
|
||||
return Err(io::Error::last_os_error());
|
||||
return Err(io::Error::new(
|
||||
#[cfg(not(polling_no_unsupported_error_kind))]
|
||||
io::ErrorKind::Unsupported,
|
||||
#[cfg(polling_no_unsupported_error_kind)]
|
||||
io::ErrorKind::Other,
|
||||
format!(
|
||||
"Failed to initialize Wepoll: {}\nThis usually only happens for old Windows or Wine.",
|
||||
io::Error::last_os_error()
|
||||
)
|
||||
));
|
||||
}
|
||||
let notified = AtomicBool::new(false);
|
||||
log::trace!("new: handle={:?}", handle);
|
||||
|
|
Loading…
Reference in New Issue