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
 
int jobListLength () const
 
Collectionoperator<< (const ThreadWeaver::JobPointer &job)
 
Collectionoperator<< (JobInterface &job)
 
Collectionoperator<< (ThreadWeaver::JobInterface *job)
 
void stop (ThreadWeaver::JobPointer job)
 
- 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
 
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
 
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 31 of file collection.h.

Member Function Documentation

◆ aboutToBeDequeued_locked()

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

Overload to dequeue the collection.

Definition at line 121 of file collection.cpp.

◆ aboutToBeQueued_locked()

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

Overload to queue the collection.

Definition at line 109 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 88 of file collection.cpp.

◆ elementCount()

int ThreadWeaver::Collection::elementCount ( ) const

Return the number of elements in the collection.

Definition at line 165 of file collection.cpp.

◆ execute()

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

Overload the execute method.

Definition at line 130 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 158 of file collection.cpp.

◆ jobListLength()

int ThreadWeaver::Collection::jobListLength ( ) const
Deprecated:
Since 5.0, use elementCount().

Definition at line 173 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 181 of file collection.cpp.

◆ operator<<() [1/2]

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

Add the job to this collection.

Definition at line 192 of file collection.cpp.

◆ operator<<() [2/2]

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

Add the job to this collection by pointer.

Definition at line 186 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 143 of file collection.cpp.

◆ stop()

void ThreadWeaver::Collection::stop ( ThreadWeaver::JobPointer  job)

Stop processing, dequeue all remaining Jobs.

job is supposed to be an element of the collection.

Definition at line 101 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-2023 The KDE developers.
Generated on Thu Mar 23 2023 04:17:46 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.