From kde-core-devel Sat Jan 22 20:55:56 2011 From: Thiago Macieira Date: Sat, 22 Jan 2011 20:55:56 +0000 To: kde-core-devel Subject: Re: The hidden problem with using QProcess/KProcess in kdelibs... Message-Id: <20110122205616.E539474AA () nargothrond ! macieira ! info> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=129572982213216 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--nextPart1770695.o7y7nWnnjf" --nextPart1770695.o7y7nWnnjf Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 --nextPart1770695.o7y7nWnnjf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iD8DBQBNO0RcM/XwBW70U1gRAmJ6AJ4o7Oxrko52AqkCYxH/pZrBU4cungCfbtut RhugOr+iHDoGdWBWAOkBUyU= =5xVT -----END PGP SIGNATURE----- --nextPart1770695.o7y7nWnnjf--