简体   繁体   English

寻找一种方法来被动监视Unix C ++中目录中的文件活动

[英]Looking for a way to on passively monitor file activity in a directory in Unix C++

I have a thread I need to wake up when there is any disk-write (preferably on a specified directory). 当有任何磁盘写入(最好在指定目录上)时,我需要唤醒一个线程。 Currently I'm doing busy wait, which works, but I hoped that an interrupt will lower CPU consumption during sleep time. 目前,我正在忙于等待,这很有效,但是我希望中断能够降低睡眠时间的CPU消耗。

The system is linux. 系统是linux。 I remember vaguely seeing such a library, but I can't find one now. 我记得隐约看到过这样的图书馆,但现在找不到。 help, please? 请帮助?

inotify可能会做您想要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM