Fix Linux examples

This commit is contained in:
Stjepan Glavina 2020-07-15 11:53:05 +02:00
parent bf154f249b
commit cb2fcede56
2 changed files with 6 additions and 4 deletions

View File

@ -11,8 +11,9 @@ fn main() -> std::io::Result<()> {
use std::ffi::OsString;
use std::io;
use async_io::Async;
use blocking::block_on;
use inotify::{EventMask, Inotify, WatchMask};
use smol::Async;
type Event = (OsString, EventMask);
@ -33,7 +34,7 @@ fn main() -> std::io::Result<()> {
}
}
smol::run(async {
block_on(async {
// Watch events in the current directory.
let mut inotify = Async::new(Inotify::init()?)?;
inotify.get_mut().add_watch(".", WatchMask::ALL_EVENTS)?;

View File

@ -12,7 +12,8 @@ fn main() -> std::io::Result<()> {
use std::os::unix::io::AsRawFd;
use std::time::{Duration, Instant};
use smol::Async;
use async_io::Async;
use blocking::block_on;
use timerfd::{SetTimeFlags, TimerFd, TimerState};
/// Converts a [`nix::Error`] into [`std::io::Error`].
@ -36,7 +37,7 @@ fn main() -> std::io::Result<()> {
Ok(())
}
smol::run(async {
block_on(async {
let start = Instant::now();
println!("Sleeping...");