I have two processes sharing the same directory for writing and reading. The first process generate data files which the seconds one reads. The second process (C++ code) has a watcher that test for arrival of new files:
template<int buffer_size>
int Watcher<buffer_size>::initWatcher(const std::string &directory) {
m_fd = inotify_init();
if(m_fd < 0) {
return 0;
}
m_wd = inotify_add_watch(m_fd, directory.c_str(), IN_MOVED_TO);
return 1;
}
Everything works fine as long a the second process has not caught up with the first. That is it can pick up new files as they arrive. But once it has caught up and processed all the files, it fails reading newly arrived files. I have tried with different notification flags but nothing helps.
My system is Linux Centos 7.0.
Thanks.