ThreadWeaver 5.109.0
List of all members
ThreadWeaver::Sequence

A Sequence is a vector of Jobs that will be executed in a sequence. More...

#include <sequence.h>

Additional Inherited Members

- Public Member Functions inherited from ThreadWeaver::Collection
 Collection (ThreadWeaver::Private::Collection_Private *d)
 
virtual void addJob (JobPointer)
 Append a job to the collection.
 
int elementCount () const
 Return the number of elements in the collection.
 
int jobListLength () const
 
Collectionoperator<< (const ThreadWeaver::JobPointer &job)
 Add the job to this collection.
 
Collectionoperator<< (JobInterface &job)
 
Collectionoperator<< (ThreadWeaver::JobInterface *job)
 Add the job to this collection by pointer.
 
void stop (ThreadWeaver::JobPointer job)
 Stop processing, dequeue all remaining Jobs.
 
- Public Member Functions inherited from ThreadWeaver::Job
 Job ()
 Construct a Job.
 
 Job (Private::Job_Private *d)
 
 ~Job () override
 Destructor.
 
void aboutToBeDequeued (QueueAPI *api) override
 This Job is about the be dequeued from the weaver's job queue.
 
void aboutToBeDequeued_locked (QueueAPI *api) override
 Called from aboutToBeDequeued() while the mutex is being held.
 
void aboutToBeQueued (QueueAPI *api) override
 The job is about to be added to the weaver's job queue.
 
void aboutToBeQueued_locked (QueueAPI *api) override
 Called from aboutToBeQueued() while the mutex is being held.
 
void assignQueuePolicy (QueuePolicy *) override
 Assign a queue policy.
 
void blockingExecute () override
 Perform the job synchronously in the current thread.
 
void execute (const JobPointer &job, Thread *) override
 Perform the job.
 
Executor * executor () const override
 Returns the executor currently set on the 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.
 
int priority () const override
 The queueing priority of the job.
 
QList< QueuePolicy * > queuePolicies () const override
 Return the queue policies assigned to this Job.
 
void removeQueuePolicy (QueuePolicy *) override
 Remove a queue policy from this job.
 
void requestAbort () override
 Abort the execution of the job.
 
Executor * setExecutor (Executor *executor) override
 Set the Executor object that is supposed to run the job.
 
void setStatus (Status) override
 Set the status of the Job.
 
Status status () const override
 The status of the job.
 
bool success () const override
 Return whether the Job finished successfully or not.
 
- Protected Member Functions inherited from ThreadWeaver::Collection
void aboutToBeDequeued_locked (QueueAPI *api) override
 Overload to dequeue the collection.
 
void aboutToBeQueued_locked (QueueAPI *api) override
 Overload to queue the collection.
 
ThreadWeaver::Private::Collection_Private * d ()
 
const ThreadWeaver::Private::Collection_Private * d () const
 
void execute (const JobPointer &job, Thread *) override
 Overload the execute method.
 
JobPointer jobAt (int i)
 Return a ref-erence to the job in the job list at position i.
 
virtual int jobListLength_locked () const
 Return the number of jobs in the joblist.
 
void run (JobPointer self, Thread *thread) override
 Overload run().
 
- Protected Member Functions inherited from ThreadWeaver::Job
Private::Job_Private * d ()
 
const Private::Job_Private * d () const
 
void defaultBegin (const JobPointer &job, Thread *thread) override
 Perform standard tasks before starting the execution of a job.
 
void defaultEnd (const JobPointer &job, Thread *thread) override
 Perform standard task after the execution of a job.
 
virtual void run (JobPointer self, Thread *thread) override=0
 The method that actually performs the job.
 

Detailed Description

A Sequence is a vector of Jobs that will be executed in a sequence.

It is implemented by automatically creating the necessary dependencies between the Jobs in the sequence.

Sequence provides a handy cleanup and unwind mechanism: the stop() slot. If it is called, the processing of the sequence will stop, and all its remaining Jobs will be dequeued. A Sequence is the first element of itself.