监控特定文件夹的事件:三种解决方法汇总
ldbivr程序中要监视特定文件夹的文件落地或者删除事件,本来要用shell中的事件通知机制,后来因为要考虑到各种意外事件,如服务意外退出、服务器崩溃等,遂作罢。
对于目录事件异步通知,大致有三个方法:
调用windows的api函数readdirectorychanges监视指定目录中文件(推荐使用),这个使用异步io:
the readdirectorychangesw function retrieves information that describes the changes within a directory.
to track changes on a volume, see change journals.
bool readdirectorychangesw(
handle hdirectory,
lpvoid lpbuffer,