|
|
The KIO::Scheduler manages io-slaves for the application. It also queues jobs and assigns the job to a slave when one becomes available.
There are 3 possible ways for a job to get a slave:
1) Direct. This is the default. When you create a job the KIO::Scheduler will be notified and will find either an existing slave that is idle or it will create a new slave for the job.
Example: TransferJob *job = KIO::get(KURL("http://www.kde.org"));
2) Scheduled If you create a lot of jobs, you might want not want to have a slave for each job. If you schedule a job, a maximum number of slaves will be created. When more jobs arrive, they will be queued. When a slave is finished with a job, it will be assigned a job from the queue.
Example: TransferJob *job = KIO::get(KURL("http://www.kde.org")); KIO::Scheduler::scheduleJob(job);
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);
typedef QList | JobList |
~Scheduler ()
| ~Scheduler |
void doJob (SimpleJob *job)
| doJob |
[static]
void scheduleJob (SimpleJob *job)
| scheduleJob |
[static]
void cancelJob (SimpleJob *job)
| cancelJob |
[static]
void jobFinished (KIO::SimpleJob *job, KIO::Slave *slave)
| jobFinished |
[static]
void putSlaveOnHold (KIO::SimpleJob *job, const KURL &url)
| putSlaveOnHold |
[static]
void removeSlaveOnHold ()
| removeSlaveOnHold |
[static]
KIO::Slave * getConnectedSlave (const KURL &url, const KIO::MetaData &config = MetaData() )
| getConnectedSlave |
[static]
Request a slave for use in connection-oriented mode.
Parameters:
url | This defines the username,password,host & port to connect with. |
config | Configuration data for the slave. |
Returns: A pointer to a connected slave or 0 if an error occured.
See also: assignJobToSlave, disconnectSlave
bool assignJobToSlave (KIO::Slave *slave, KIO::SimpleJob *job)
| assignJobToSlave |
[static]
bool disconnectSlave (KIO::Slave *slave)
| disconnectSlave |
[static]
bool connect ( const char *signal, const QObject *receiver,
const char *member)
| connect |
[static]
Function to connect signals emitted by the scheduler.
See also: slaveConnected, slaveError
Reimplemented from QObject.
bool connect ( const QObject* sender, const char* signal,
const QObject* receiver, const char* member )
| connect |
[static]
Reimplemented from QObject.
bool disconnect ( const QObject* sender, const char* signal,
const QObject* receiver, const char* member )
| disconnect |
[static]
Reimplemented from QObject.
bool connect ( const QObject *sender, const char *signal,
const char *member )
| connect |
Reimplemented from QObject.
void debug_info ()
| debug_info |
bool process (const QCString &fun, const QByteArray &data,
QCString& replyType, QByteArray &replyData)
| process |
[virtual]
Reimplemented from DCOPObject.
QCStringList functions ()
| functions |
[virtual]
Reimplemented from DCOPObject.
void slotSlaveDied (KIO::Slave *slave)
| slotSlaveDied |
[slot]
void slotSlaveStatus (pid_t pid, const QCString &protocol,
const QString &host, bool connected)
| slotSlaveStatus |
[slot]
void slaveConnected (KIO::Slave *slave)
| slaveConnected |
[signal]
void slaveError (KIO::Slave *slave, int error, const QString &errorMsg)
| slaveError |
[signal]
bool startJobScheduled (ProtocolInfo *protInfo)
| startJobScheduled |
[protected]
bool startJobDirect ()
| startJobDirect |
[protected]
Scheduler ()
| Scheduler |
[protected]
void startStep ()
| startStep |
[protected slots slot]
void slotCleanIdleSlaves ()
| slotCleanIdleSlaves |
[protected slots slot]
void slotSlaveConnected ()
| slotSlaveConnected |
[protected slots slot]
void slotSlaveError (int error, const QString &errorMsg)
| slotSlaveError |
[protected slots slot]
void slotScheduleCoSlave ()
| slotScheduleCoSlave |
[protected slots slot]
Generated by: dfaure on kde.faure.org on Thu Jan 17 22:16:53 2002, using kdoc 2.0a53. |