[Qt-interest] bash jobcontrol breaks QT4 and inotify ?

David Heremans david.heremans at intersoft-electronics.com
Mon Aug 16 09:35:26 CEST 2010


On 08/13/2010 07:29 PM, Andreas Pakulat wrote:
> On 13.08.10 15:09:41, David Heremans wrote:
>> Hello,

> Why are you using inotify at all instead of using Qt's existing api to
> watch files/dirs: QFileSystemWatcher? It uses inotify on Linux and
> whatever the OS provides on other platforms. And it still works after
> Ctrl+Z; fg.
> 
> Andreas
> 

Well convenience would be most correct answer.
With inotify I can know the reason why the signal is triggered. I only
want to react on a IN_MOVE (file being mv'ed into the directory) and
IN_CLOSE_WRITE (file being closed after it has been opened for writing)

If I use QFileSystemWatcher and I get an directoryChanged signal then I
still need to parse the directory to find the new files, while inotify
provides the filename immediately.
And with the fileChanged signal I can not know if the file is still
being writing to or if the writer has finished filling up data. These
files contain data read over a serial 1200 baud connection so in the
QFileSystemWatcher-tests I made the file wasn't completed by the time I
first received the signals.

Besides from the practical aplication, I'm still very interested in why
the program reacts this way after a 'CTRL-Z & bg' If this behavior is to
be expected then I have a knowledge gap and knowing the 'why' of this
problem will probably help me in the future to avoid such problems in
other circumstances.

rgds

David H








More information about the Qt-interest-old mailing list