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

List:       kde-devel
Subject:    KIO::Scheduler::assignJobToSlave()
From:       Paulo Moura Guedes <pmg () netcabo ! pt>
Date:       2004-04-29 2:33:37
Message-ID: 200404290333.37474.pmg () netcabo ! pt
[Download RAW message or body]

Hi,

For performance I want to use the same connection for several jobs.
The point 3 of detailed description of class KIO::Scheduler seemed to be just 
what I want 
(http://developer.kde.org/documentation/library/cvs-api/kio/html/classKIO_1_1Scheduler.html):

> 3. Connection Oriented
> For some operations it is important that multiple jobs use the same 
connection. This can only be ensured if all these jobs use the same slave.
>  You can ask the scheduler to open a slave for connection oriented 
operations. You can then use the scheduler to assign jobs to this slave. The 
jobs will be queued and the slave will handle these jobs one after the 
other.> Example: 
> 
>     Slave *slave = KIO::Scheduler::getConnectedSlave(
>             KURL("pop3://bastian:password@mail.kde.org"));
>     TransferJob *job1 = KIO::get(
>             KURL("pop3://bastian:password@mail.kde.org/msg1"));
>     KIO::Scheduler::assignJobToSlave(slave, job1);
>     TransferJob *job2 = KIO::get(
>             KURL("pop3://bastian:password@mail.kde.org/msg2"));
>     KIO::Scheduler::assignJobToSlave(slave, job2);
>     TransferJob *job3 = KIO::get(
>             KURL("pop3://bastian:password@mail.kde.org/msg3"));
>     KIO::Scheduler::assignJobToSlave(slave, job3);
> 
>     // ... Wait for jobs to finish...
> 
>     KIO::Scheduler::disconnectSlave(slave);

What I tried to do was to create a slave once, with 
KIO::Scheduler::getConnectedSlave, and then use that slave when I need to get 
local domain URLs, with KIO::Scheduler::assignJobToSlave(). 
I get a segfault, somewhere in the process, when I try to connect one of the 
jobs to the slots.

Then I looked at KIO::Scheduler source code and it says:
> * @param slave 	The slave to use. The slave must have been obtained
> *              			with a call to @ref getConnectedSlave and must not
> *              			be currently assigned to any other job.

Not currently assigned to other jobs? That's not what is done in the first 
example?

Can you give some directions in order the benefit from using the same 
connection?
-- 
Paulo Moura Guedes
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

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