-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
A-tokioArea: The main tokio crateArea: The main tokio crateC-bugCategory: This is a bug.Category: This is a bug.M-ioModule: tokio/ioModule: tokio/io
Description
I'm not sure if the issue is with my usage, and I look forward to your help. Here is my reproduction code.
main.rs
use std::sync::Arc;
use std::time::Duration;
use tokio::io::unix::AsyncFd;
#[tokio::main]
async fn main() {
loop {
let fd = unsafe { libc::inotify_init1(libc::O_CLOEXEC | libc::O_NONBLOCK) };
if fd == -1 {
return;
}
let afd = Arc::new(fd);
let async_fd = AsyncFd::new(afd.clone()).unwrap();
unsafe {
libc::close(fd);
}
tokio::time::sleep(Duration::from_millis(1)).await;
drop(async_fd);
}
}
Cargo.toml
[dependencies]
[package]
name = "testexamples"
version = "0.1.0"
edition = "2024"
[dependencies]
tokio = { version = "1.47.1", features = ["full"] }
libc = "0.2.174"
Metadata
Metadata
Assignees
Labels
A-tokioArea: The main tokio crateArea: The main tokio crateC-bugCategory: This is a bug.Category: This is a bug.M-ioModule: tokio/ioModule: tokio/io