use std::env;
use std::fs::File;
use std::thread;
use std::time::Duration;
use nix::fcntl::OFlag;
use nix::sys::epoll::Epoll;
use nix::sys::epoll::EpollCreateFlags;
use nix::sys::epoll::EpollEvent;
use nix::sys::epoll::EpollFlags;
use nix::unistd::pipe2;
fn main() {
let signal_path =
env::var("PTOOLS_TEST_READY_FILE").expect("PTOOLS_TEST_READY_FILE must be set");
let (readfd, _writefd) = pipe2(OFlag::O_CLOEXEC | OFlag::O_NONBLOCK).unwrap();
let epoll = Epoll::new(EpollCreateFlags::empty()).unwrap();
let event = EpollEvent::new(EpollFlags::EPOLLIN, 0);
epoll.add(&readfd, event).unwrap();
File::create(signal_path).unwrap();
loop {
thread::sleep(Duration::from_millis(100));
}
}