From kde-core-devel Tue Jul 15 15:13:18 2008 From: Thiago Macieira Date: Tue, 15 Jul 2008 15:13:18 +0000 To: kde-core-devel Subject: Re: [PATCH] KIO::SlaveBase and the event loop Message-Id: <200807151213.18744.thiago () kde ! org> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=121613484614351 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--nextPart64014725.agIKhhg6Px" --nextPart64014725.agIKhhg6Px Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sebastian Tr=FCg wrote: >On Tuesday 15 July 2008 14:45:54 Thiago Macieira wrote: >> Sebastian Tr=FCg wrote: >> >> I tried implementing that last year and gave up. >> > >> >what were the problems? >> >> Well, my plan was a bit more ambitious. I wanted all ioslaves to run >> inside an event loop. The KIO::Connection would be used in in >> readyRead() slot handlers instead of waitFor* style functions as it is >> right now. >> >> It was too much work for too little gain. > >one more question: do you know if there is a problem with calling the >SlaveBase methods such as listEntry from another thread? Do I have to > handle that through QueuedConnections? QueuedConnection implies an event loop to receive them, but not to send.=20 If you want to use that, you need to start an event loop in the other=20 thread. The way that you phrased your question, I understand that you=20 meant calling the main thread from the auxiliary D-Bus thread. So you go=20 back to your original issue: an event loop in the main thread. However, let me try to understand the issue at hand: you have an ioslave=20 that retrieves data via D-Bus and said data comes via D-Bus signals.=20 (That would explain why you need an event loop) If that is so, then you can just start a QEventLoop inside your listDir()=20 reimplementation. Once the data has finished transferring, you don't need=20 to handle the D-Bus socket anymore. You *only* need a thread if you need to react to external D-Bus signals=20 outside of an IOSlave call. (Those could be things like connection=20 maintenance, watching for something, etc.) =2D-=20 =A0 Thiago Macieira =A0- =A0thiago (AT) macieira.info - thiago (AT) kde.org =A0 =A0 PGP/GPG: 0x6EF45358; fingerprint: =A0 =A0 E067 918B B660 DBD1 105C =A0966C 33F5 F005 6EF4 5358 --nextPart64014725.agIKhhg6Px Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iD8DBQBIfL6OM/XwBW70U1gRAu8KAJ9CNle+gEtAYWIn/uTaHjafL1OBjgCgmBFo dWtCFv4fUry2PJzO9r81lC8= =+PH5 -----END PGP SIGNATURE----- --nextPart64014725.agIKhhg6Px--