[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: The hidden problem with using QProcess/KProcess in kdelibs...
From:       Thiago Macieira <thiago () kde ! org>
Date:       2011-01-22 20:55:56
Message-ID: 20110122205616.E539474AA () nargothrond ! macieira ! info
[Download RAW message or body]


On Saturday, 22 de January de 2011 14:25:07 Dawit A wrote:
> Anyhow, this problem is not specific to VLC and can happen to any Qt
> application that blocks the SIGCHLD signals from reaching any of the
> threads. As such I think some action needs to be taken to address this
> issue. We can workaround this issue by unseting and setting the signal
> masks in the aforementioned function, but there are many other places
> in kdelibs where QProcess is used so perhaps a better resolution is
> needed for this ? Perhaps it is QProcess that should be taking care of
> this itself ?

I agree with you. QProcess relies on SIGCHLD being delivered to its signal 
handler. Unlike VLC, we don't try to mask it to one thread only. Instead, the 
signal handler function is written so that it can be run on any thread, and it 
signals an auxiliary thread (the QProcessManager thread) to do the non-async-
safe operations.

So for QProcess to work, it requires that people don't disrupt the above.

Setting signal masks is fine as long as you don't block it -- the signal 
handler will still be invoked in one thread. If you override with a different 
handler, then at least ensure Qt's is run.

If the code you pasted from VLC is run after QCoreApplication's constructor, 
the signal(SIGCHLD, SIG_DFL); call removes QProcessManager support.

QProcess could ensure that its handler is still in place before using them.

However, what I really want is that kernel developers give me a modern way of 
finding out a process has exited.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic