[PATCH] KIO::SlaveBase and the event loop
Thiago Macieira
thiago at kde.org
Tue Jul 15 16:13:18 BST 2008
Sebastian Trüg wrote:
>On Tuesday 15 July 2008 14:45:54 Thiago Macieira wrote:
>> Sebastian Trüg 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.
If you want to use that, you need to start an event loop in the other
thread. The way that you phrased your question, I understand that you
meant calling the main thread from the auxiliary D-Bus thread. So you go
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
that retrieves data via D-Bus and said data comes via D-Bus signals.
(That would explain why you need an event loop)
If that is so, then you can just start a QEventLoop inside your listDir()
reimplementation. Once the data has finished transferring, you don't need
to handle the D-Bus socket anymore.
You *only* need a thread if you need to react to external D-Bus signals
outside of an IOSlave call. (Those could be things like connection
maintenance, watching for something, etc.)
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080715/16f0f925/attachment.sig>
More information about the kde-core-devel
mailing list