[Qt-interest] bash jobcontrol breaks QT4 and inotify ?
Andreas Pakulat
apaku at gmx.de
Tue Aug 17 10:38:00 CEST 2010
On 17.08.10 10:22:07, Andreas Pakulat wrote:
> > I'm still puzzled by this program going hay-wire after a 'Ctrl+Z;fg'
> > I found out the following extra info. I monitored the program with htop
> > so that I could se the threads and when I launch the program I get
> > 7577 david 20 0 249M 21456 1584 S 0.0 0.4 0:00.10 ./inotify_demo
> > 7578 david 20 0 249M 21456 1584 S 0.0 0.4 0:00.00 ./inotify_demo
> > 7579 david 20 0 249M 21456 1584 S 0.0 0.4 0:00.00 ./inotify_demo
> >
> > which should be the main process and two threads
>
> No, these are 3 separate instances of the same app. You cannot see the
> threads inside the process using htop.
>
> > If I press CTRL-Z
> > the stae of all 3 goes from S(leeping) to T(Traced/stopped)
> >
> > However after giving the fg command
> > 7577 david 20 0 249M 21456 1584 S 0.0 0.4 0:00.18 ./inotify_demo
> > 7578 david 20 0 249M 21456 1584 S 0.0 0.4 0:00.00 ./inotify_demo
> >
> > It seems that the last thread has vanished!
>
> This has nothing to do with your problem. Your problem is that the
> while-loop in the threads run method exits once the app resumes. Now I
> don't have the slightest clue why this happens or how inotify is supposed
> to be used. However this has nothing to do with Qt, so maybe ask in a
> Linux-Kernel-related forum why reading from the filedescriptor breaks after
> suspending the app.
A quick look into man 7 signals and searching for EINTR suggested by Rohan
reveals at least 2 possible fixes to your problem: Either set SA_RESTART or
check for EINTR return value in the while(read...) condition.
Andreas
--
You will be awarded the Nobel Peace Prize... posthumously.
More information about the Qt-interest-old
mailing list