|
fcntl(fd, F_SETSIG, SIGRTMIN);
fcntl(fd, F_NOTIFY, DN_MODIFY|DN_CREATE|DN_MULTISHOT);
/* we will now be notified if any of the files
in "." is modified or new files are created */
while (1) {
// 收到信号后,就会执行信号处理例程。
// 而 pause() 也就结束了。
pause();
printf("Got event on fd=%d\n", event_fd);
}
}
上面这一小段例程,对于熟悉 Linux 系统编程的读者朋 页码:[1] [2] [3] [4] [5] [6] 第4页、共6页 |