ThreadWeaver 5.109.0
Public Member Functions | List of all members
ThreadWeaver::ShuttingDownState

ShuttingDownState is enabled when the Weaver destructor is entered. More...

#include <shuttingdownstate.h>

Public Member Functions

 ShuttingDownState (QueueSignals *weaver)
 
JobPointer applyForWork (Thread *th, bool wasBusy) override
 Assign a job to an idle thread.
 
void resume () override
 Resume job processing.
 
void shutDown () override
 Shut down the queue.
 
StateId stateId () const override
 reimpl
 
void suspend () override
 Suspend job processing.
 
void waitForAvailableJob (Thread *th) override
 Wait (by suspending the calling thread) until a job becomes available.
 
- Public Member Functions inherited from ThreadWeaver::WeaverImplState
 WeaverImplState (QueueSignals *weaver)
 
int currentNumberOfThreads () const override
 Returns the current number of threads in the inventory.
 
void dequeue () override
 Dequeue all jobs.
 
bool dequeue (const JobPointer &job) override
 Dequeue a job.
 
void enqueue (const QVector< JobPointer > &jobs) override
 Enqueue a job.
 
void finish () override
 Finish all queued jobs.
 
bool isEmpty () const override
 Are no more jobs queued?
 
bool isIdle () const override
 Are all threads waiting?
 
int maximumNumberOfThreads () const override
 Get the maximum number of threads this Weaver may start.
 
int queueLength () const override
 How many jobs are currently queued?
 
void requestAbort () override
 Request abort for all queued and currently executed jobs.
 
void reschedule () override
 Reschedule jobs to threads.
 
void setMaximumNumberOfThreads (int cap) override
 Set the maximum number of threads this Weaver object may start.
 
void shutDown () override
 Shut down the queue.
 
const Statestate () const override
 Return the state of the weaver object.
 
void waitForAvailableJob (Thread *th) override
 Wait (by suspending the calling thread) until a job becomes available.
 
- Public Member Functions inherited from ThreadWeaver::State
 State (QueueSignals *weaver)
 Default constructor.
 
 ~State () override
 Destructor.
 
virtual void activated ()
 The state has been changed so that this object is responsible for state handling.
 
virtual StateId stateId () const =0
 The state Id.
 
QString stateName () const
 The ID of the current state.
 
virtual int currentNumberOfThreads () const =0
 Returns the current number of threads in the inventory.
 
virtual void dequeue ()=0
 Remove all queued jobs.
 
virtual bool dequeue (const JobPointer &job)=0
 Remove a job from the queue.
 
virtual void enqueue (const QVector< JobPointer > &jobs)=0
 Queue a vector of jobs.
 
virtual void finish ()=0
 Finish all queued operations, then return.
 
virtual bool isEmpty () const =0
 Is the queue empty? The queue is empty if no more jobs are queued.
 
virtual bool isIdle () const =0
 Is the weaver idle? The weaver is idle if no jobs are queued and no jobs are processed by the threads.
 
virtual int maximumNumberOfThreads () const =0
 Get the maximum number of threads this Weaver may start.
 
virtual int queueLength () const =0
 Returns the number of pending jobs.
 
virtual void requestAbort ()=0
 Request aborts of the currently executed jobs.
 
virtual void reschedule ()=0
 Reschedule the jobs in the queue.
 
virtual void resume ()=0
 Resume job queueing.
 
virtual void setMaximumNumberOfThreads (int cap)=0
 Set the maximum number of threads this Weaver object may start.
 
virtual void shutDown ()=0
 Shut down the queue.
 
virtual const Statestate () const =0
 Return the state of the weaver object.
 
virtual void suspend ()=0
 Suspend job execution.
 

Additional Inherited Members

- Protected Member Functions inherited from ThreadWeaver::WeaverImplState
const Weaverweaver () const override
 
Weaverweaver () override
 Provide correct return type for WeaverImpl states.
 
virtual QueueInterfaceweaver ()
 The Weaver interface this state handles.
 
virtual const QueueInterfaceweaver () const
 

Detailed Description

ShuttingDownState is enabled when the Weaver destructor is entered.

It prevents threads from still accessing queue management methods, and new jobs being queued.

Member Function Documentation

◆ applyForWork()

JobPointer ThreadWeaver::ShuttingDownState::applyForWork ( Thread th,
bool  wasBusy 
)
override

Assign a job to an idle thread.

◆ resume()

void ThreadWeaver::ShuttingDownState::resume ( )
overridevirtual

Resume job processing.

Implements ThreadWeaver::QueueInterface.

◆ shutDown()

void ThreadWeaver::ShuttingDownState::shutDown ( )
overridevirtual

Shut down the queue.

Implements ThreadWeaver::QueueInterface.

◆ stateId()

StateId ThreadWeaver::ShuttingDownState::stateId ( ) const
overridevirtual

reimpl

Implements ThreadWeaver::State.

◆ suspend()

void ThreadWeaver::ShuttingDownState::suspend ( )
overridevirtual

Suspend job processing.

Implements ThreadWeaver::QueueInterface.

◆ waitForAvailableJob()

void ThreadWeaver::ShuttingDownState::waitForAvailableJob ( Thread th)
override

Wait (by suspending the calling thread) until a job becomes available.