11#ifndef THREADWEAVER_JOB_H
12#define THREADWEAVER_JOB_H
14#include "jobinterface.h"
15#include "jobpointer.h"
16#include "threadweaver_export.h"
46class THREADWEAVER_EXPORT
Job :
public JobInterface
51 Job(Private::Job_Private *d);
176 Private::Job_Private *d_;
179 Private::Job_Private *d();
180 const Private::Job_Private *d()
const;
182 friend class Executor;
193 virtual void run(JobPointer self,
Thread *thread)
override = 0;
A Job is a simple abstraction of an action that is to be executed in a thread context.
Definition job.h:47
void defaultBegin(const JobPointer &job, Thread *thread) override
Perform standard tasks before starting the execution of a job.
void blockingExecute() override
Perform the job synchronously in the current thread.
Status status() const override
The status of the job.
void aboutToBeDequeued(QueueAPI *api) override
This Job is about the be dequeued from the weaver's job queue.
Executor * setExecutor(Executor *executor) override
Set the Executor object that is supposed to run the job.
void assignQueuePolicy(QueuePolicy *) override
Assign a queue policy.
void removeQueuePolicy(QueuePolicy *) override
Remove a queue policy from this job.
bool isFinished() const override
Returns true if the jobs's execute method finished.
QMutex * mutex() const override
The mutex used to protect this job.
void aboutToBeDequeued_locked(QueueAPI *api) override
Called from aboutToBeDequeued() while the mutex is being held.
void setStatus(Status) override
Set the status of the Job.
int priority() const override
The queueing priority of the job.
void aboutToBeQueued(QueueAPI *api) override
The job is about to be added to the weaver's job queue.
virtual void run(JobPointer self, Thread *thread) override=0
The method that actually performs the job.
~Job() override
Destructor.
void execute(const JobPointer &job, Thread *) override
Perform the job.
bool success() const override
Return whether the Job finished successfully or not.
Executor * executor() const override
Returns the executor currently set on the Job.
void aboutToBeQueued_locked(QueueAPI *api) override
Called from aboutToBeQueued() while the mutex is being held.
QList< QueuePolicy * > queuePolicies() const override
Return the queue policies assigned to this Job.
void requestAbort() override
Abort the execution of the job.
Definition job.h:124
void defaultEnd(const JobPointer &job, Thread *thread) override
Perform standard task after the execution of a job.
QueuePolicy is an interface for customizations of the queueing behaviour of jobs.
Definition queuepolicy.h:39
Thread represents a worker thread in a Queue's inventory.
Definition thread.h:28