From kde-devel Sun Aug 10 17:20:52 2003 From: Thiago Macieira Date: Sun, 10 Aug 2003 17:20:52 +0000 To: kde-devel Subject: Re: Waiting for a process to terminate X-MARC-Message: https://marc.info/?l=kde-devel&m=106053619413073 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============34474277099536987==" --===============34474277099536987== Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Boundary-02=_77nN/OCO7lCNHOT"; charset="iso-8859-1" Content-Transfer-Encoding: 7bit --Boundary-02=_77nN/OCO7lCNHOT Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Joao Luis Silva Assuncao wrote: >Hello all, >I'm using a thread (QThread) to do some heavy job that implies to execute >multiples times another program. Since it must wait until the process ends > to execute a new process, I think I can use the signal processExited to > know when the process ends, but that implies that the thread must be a > QObject to receive the signal. I readied in QT documentation and in some > tutorial about kde and MT that QObject derived classes should not be used > within threads, so this idea of using signals inside threads is probably > not a good idea. So how can I execute a process within a thread, waiting > for it to complete but without blocking my application? You cannot use signals accross threads. Signals are confined to the main Qt= =20 event thread. I recommend that, instead, you start your process from the event thread and= =20 use the normal signalling mechanisms for the child process's exit. When you= =20 detect that it's done, you can start another. If you need a thread to proce= ss=20 some data the child created, start the thread at that moment or, if it's=20 already running, use QWaitCondition or QSemaphore to tell it new data is=20 available. =2D-=20 Thiago Macieira - Registered Linux user #65028 thiagom@mail.com =20 ICQ UIN: 1967141 PGP/GPG: 0x6EF45358; fingerprint: E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358 --Boundary-02=_77nN/OCO7lCNHOT Content-Type: application/pgp-signature Content-Description: signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQA/Nn77M/XwBW70U1gRArc3AJ9OEPFxDI2yIiyK9pXoiWO1K+BB4gCgm2Q0 tcrBlmSnqnQ6CTRcHrWwOV0= =//0E -----END PGP SIGNATURE----- --Boundary-02=_77nN/OCO7lCNHOT-- --===============34474277099536987== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << --===============34474277099536987==--