[Qt-interest] bash jobcontrol breaks QT4 and inotify ?
Andreas Pakulat
apaku at gmx.de
Fri Aug 13 19:29:33 CEST 2010
On 13.08.10 15:09:41, David Heremans wrote:
> 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?)
>
> I'm running kubuntu lucid lynx (64 bit)
> with qtcreator 1.3.1, based on qt 4.6.2(64 bit)
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
--
Your own qualities will help prevent your advancement in the world.
More information about the Qt-interest-old
mailing list