MailCommon::JobScheduler Class

class MailCommon::JobScheduler
Header: #include <MailCommon/JobScheduler>
CMake: find_package(KPim6MailCommon REQUIRED)
target_link_libraries(mytarget PRIVATE KPim6::MailCommon)
Inherits: QObject

Public Functions

JobScheduler(QObject *parent)
virtual ~JobScheduler() override
void pause()
void registerTask(MailCommon::ScheduledTask *task)
void resume()

Detailed Description

The unique JobScheduler instance (owned by kmkernel) implements "background processing" of folder operations (like expiration and compaction). Tasks (things to be done) are registered with the JobScheduler, and it will execute them one at a time, separated by a 1-minute timer. The jobs themselves should use timers to avoid using too much CPU for too long. Tasks for opened folders are not executed until the folder is closed.

Member Function Documentation

[explicit] JobScheduler::JobScheduler(QObject *parent)

Constructs a job scheduler.

parent The parent object

[override virtual noexcept] JobScheduler::~JobScheduler()

Destroys the job scheduler.

void JobScheduler::pause()

Pauses the job scheduler, preventing new jobs from being started.

void JobScheduler::registerTask(MailCommon::ScheduledTask *task)

Register a task to be done for a given folder. The ownership of the task is transferred to the JobScheduler.

task The task to register

void JobScheduler::resume()

Resumes the job scheduler after being paused.