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

Rohan McGovern rohan.mcgovern at nokia.com
Mon Aug 16 00:41:33 CEST 2010


David Heremans said:
> Hello,
> 
> I was trying to find a nice way to have my program react upon new files
> that could pop-up in a given /var/spool directory. Since it runs on a
> linux box  I thought about using inotify, and a quick Google got me to
> this page:
> 
> http://wahjava.wordpress.com/2007/05/09/my-experiment-with-inotify-and-qt4/
> 
> I downloaded the small example inotify.tgz and it worked as a charm so I
> decided to try to integrate the inotify.hh and inotify.cc into my
> program, but it doesn't seem to work correctly, so I had to look at the
> example again and (by accident) I found the following strange behavior.
> 
> If I launch the ./inotify_demo (from an xterm/konsole) and start
> monitoring a directory it works nicely. But if a press CTRL-Z and bring
> it back to the foreground (with the fg command) it simply stops reacting
> to changes? Even pressing the stop/start button doesn't reactivate the
> program.
> 
> Can somebody here explain me the impact of the CTRL-Z on the inotify
> mechanism? Could it be that running my program in the debugger doesn't
> work because of some unknown-to-me impact from signals (on  the threads?)
> 

As someone already mentioned, you should try to use QFileSystemWatcher,
which already uses inotify under the hood where possible.

Otherwise, this is most likely not a Qt problem.  I didn't read the
code, but if CTRL+Z breaks it, it sounds like it's probably doing some
system call without restarting on EINTR.
-- 
Rohan McGovern
QA Engineer
Qt Development Frameworks, Nokia



More information about the Qt-interest-old mailing list