ThreadWeaver::Collection

Search for usage in LXR

ThreadWeaver::Collection Class Reference

#include <collection.h>

Inheritance diagram for ThreadWeaver::Collection:

Public Member Functions

 Collection (ThreadWeaver::Private::Collection_Private *d)
 
virtual void addJob (JobPointer)
 
int elementCount () const
 
Collectionoperator<< (const ThreadWeaver::JobPointer &job)
 
Collectionoperator<< (JobInterface &job)
 
Collectionoperator<< (ThreadWeaver::JobInterface *job)
 
void requestAbort () override
 
void stop ()
 
- Public Member Functions inherited from ThreadWeaver::Job
 Job ()
 
 Job (Private::Job_Private *d)
 
 ~Job () override
 
void aboutToBeDequeued (QueueAPI *api) override
 
void aboutToBeDequeued_locked (QueueAPI *api) override
 
void aboutToBeQueued (QueueAPI *api) override
 
void aboutToBeQueued_locked (QueueAPI *api) override
 
void assignQueuePolicy (QueuePolicy *) override
 
void blockingExecute () override
 
void execute (const JobPointer &job, Thread *) override
 
Executor * executor () const override
 
bool isFinished () const override
 
QMutexmutex () const override
 
void onFinish (const std::function< void(const JobInterface &job)> &lambda)
 
int priority () const override
 
QList< QueuePolicy * > queuePolicies () const override
 
void removeQueuePolicy (QueuePolicy *) override
 
void requestAbort () override
 
Executor * setExecutor (Executor *executor) override
 
void setStatus (Status) override
 
bool shouldAbort () const
 
Status status () const override
 
bool success () const override
 

Protected Member Functions

void aboutToBeDequeued_locked (QueueAPI *api) override
 
void aboutToBeQueued_locked (QueueAPI *api) override
 
ThreadWeaver::Private::Collection_Private * d ()
 
const ThreadWeaver::Private::Collection_Private * d () const
 
void execute (const JobPointer &job, Thread *) override
 
JobPointer jobAt (int i)
 
virtual int jobListLength_locked () const
 
void run (JobPointer self, Thread *thread) override
 
- 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
 
void defaultEnd (const JobPointer &job, Thread *thread) override
 

Detailed Description

A Collection is a vector of Jobs that will be queued together.

In a Collection, the order of execution of the elements is not specified.

It is intended that the collection is set up first and then queued. After queuing, no further jobs should be added to the collection.

Definition at line 34 of file collection.h.

Constructor & Destructor Documentation

◆ Collection()

ThreadWeaver::Collection::Collection ( )

Definition at line 65 of file collection.cpp.

◆ ~Collection()

ThreadWeaver::Collection::~Collection ( )
override

Definition at line 75 of file collection.cpp.

Member Function Documentation

◆ aboutToBeDequeued_locked()

void ThreadWeaver::Collection::aboutToBeDequeued_locked ( QueueAPI * api)
overrideprotected

Overload to dequeue the collection.

Definition at line 122 of file collection.cpp.

◆ aboutToBeQueued_locked()

void ThreadWeaver::Collection::aboutToBeQueued_locked ( QueueAPI * api)
overrideprotected

Overload to queue the collection.

Definition at line 110 of file collection.cpp.

◆ addJob()

void ThreadWeaver::Collection::addJob ( JobPointer job)
virtual

Append a job to the collection.

To use Collection, create the Job objects first, add them to the collection, and then queue it. After the collection has been queued, no further Jobs are supposed to be added.

Note
Once the job has been added, execute wrappers can no more be set on it

Definition at line 86 of file collection.cpp.

◆ d() [1/2]

Private::Collection_Private * ThreadWeaver::Collection::d ( )
protected

Definition at line 158 of file collection.cpp.

◆ d() [2/2]

const Private::Collection_Private * ThreadWeaver::Collection::d ( ) const
protected

Definition at line 163 of file collection.cpp.

◆ elementCount()

int ThreadWeaver::Collection::elementCount ( ) const

Return the number of elements in the collection.

Definition at line 175 of file collection.cpp.

◆ execute()

void ThreadWeaver::Collection::execute ( const JobPointer & job,
Thread * thread )
overrideprotected

Overload the execute method.

Definition at line 140 of file collection.cpp.

◆ jobAt()

JobPointer ThreadWeaver::Collection::jobAt ( int i)
protected

Return a ref-erence to the job in the job list at position i.

Definition at line 168 of file collection.cpp.

◆ jobListLength_locked()

int ThreadWeaver::Collection::jobListLength_locked ( ) const
protectedvirtual

Return the number of jobs in the joblist.

Assumes that the mutex is being held.

Definition at line 182 of file collection.cpp.

◆ operator<<() [1/3]

Collection & ThreadWeaver::Collection::operator<< ( const ThreadWeaver::JobPointer & job)

Add the job to this collection.

Definition at line 193 of file collection.cpp.

◆ operator<<() [2/3]

Collection & ThreadWeaver::Collection::operator<< ( JobInterface & job)

Definition at line 199 of file collection.cpp.

◆ operator<<() [3/3]

Collection & ThreadWeaver::Collection::operator<< ( ThreadWeaver::JobInterface * job)

Add the job to this collection by pointer.

Definition at line 187 of file collection.cpp.

◆ requestAbort()

void ThreadWeaver::Collection::requestAbort ( )
override

Dequeue all remaining Jobs and request abortion of all running jobs.

See also
Job::requestAbort()
Since
6.0

Definition at line 104 of file collection.cpp.

◆ run()

void ThreadWeaver::Collection::run ( JobPointer self,
Thread * thread )
overrideprotectedvirtual

Overload run().

We have to.

Implements ThreadWeaver::Job.

Definition at line 153 of file collection.cpp.

◆ stop()

void ThreadWeaver::Collection::stop ( )

Stop processing, dequeue all remaining Jobs.

Since
6.0

Definition at line 99 of file collection.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:40:09 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.