Just released a new version of SimpleFileWatcher. Not a lot of new content, but a pretty serious bug was fixed for Win32 and some better error handling. I create some more maintainable build scripts using premake. Also, I moved the OgreDemo off to its own directory to help contain all the files.
Download: SimpleFileWatcher 2009.09.14
hi there, i am trying to use your library for a project. I keep getting error:
FileWatcherLinux.cpp
../../source/FileWatcherLinux.cpp: In member function ‘virtual void FW::FileWatcherLinux::update()’:
../../source/FileWatcherLinux.cpp:147:36: error: ‘read’ was not declared in this scope
len = read (mFD, buff, BUFF_SIZE);
I am using gcc version 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC) .
Including #include in FileWatcherLinux fixes the issues, but I am not sure if that will have any other side effects?
I had 2 more questions:
1. My app needs to continuously watch for file modifications. Does that mean I will have to keep calling update() in a while loop?
2. Does the read() call, block the thread and keep the CPU busy? Or does the thread go to sleep and “wakes” up only when an event comes in?
I haven’t seen that issue. Please create a bug on the github project and I’ll try to investigate it.
https://github.com/jameswynn/simplefilewatcher
1. In response to your questions though, the library is designed to work in the application’s main loop, so you would call this update function there.
2. The read call is blocking, but it only blocks while it is reading the update which should be very quick.
sorry, i meant …. Including unistd.h in FileWatcherLinux fixes the issues,