ThreadWeaver::Weaver Class
class ThreadWeaver::WeaverA Weaver manages worker threads. More...
Header: | #include <ThreadWeaver/Weaver> |
CMake: | find_package(KF6 REQUIRED COMPONENTS ThreadWeaver) target_link_libraries(mytarget PRIVATE KF6::ThreadWeaver) |
Inherits: | ThreadWeaver::QueueAPI |
Public Functions
Weaver(QObject *parent = nullptr) | |
int | activeThreadCount() |
void | blockThreadUntilJobsAreBeingAssigned(ThreadWeaver::Thread *th) |
void | blockThreadUntilJobsAreBeingAssigned_locked(ThreadWeaver::Thread *th) |
void | decActiveThreadCount() |
void | enqueue_p(const QList<ThreadWeaver::JobPointer> &jobs) |
void | incActiveThreadCount() |
void | setState(ThreadWeaver::StateId) |
void | setState_p(ThreadWeaver::StateId) |
ThreadWeaver::JobPointer | takeFirstAvailableJobOrSuspendOrWait(ThreadWeaver::Thread *th, bool threadWasBusy, bool suspendIfAllThreadsInactive, bool justReturning) |
void | threadEnteredRun(ThreadWeaver::Thread *thread) |
Signals
void | threadExited(ThreadWeaver::Thread *) |
void | threadStarted(ThreadWeaver::Thread *) |
void | threadSuspended(ThreadWeaver::Thread *) |
Protected Functions
void | adjustActiveThreadCount(int diff) |
void | adjustInventory(int noOfNewJobs) |
virtual ThreadWeaver::Thread * | createThread() |
Detailed Description
It creates an inventory of Thread objects to which it assigns jobs from its queue. It extends the API of Queue, hiding methods that need to be public to implement state handling, but should not be exposed in general.
Member Function Documentation
[explicit]
Weaver::Weaver(QObject *parent = nullptr)
int Weaver::activeThreadCount()
[protected]
void Weaver::adjustActiveThreadCount(int diff)
[protected]
void Weaver::adjustInventory(int noOfNewJobs)
void Weaver::blockThreadUntilJobsAreBeingAssigned(ThreadWeaver::Thread *th)
void Weaver::blockThreadUntilJobsAreBeingAssigned_locked(ThreadWeaver::Thread *th)
[virtual protected]
ThreadWeaver::Thread *Weaver::createThread()
void Weaver::decActiveThreadCount()
void Weaver::enqueue_p(const QList<ThreadWeaver::JobPointer> &jobs)
void Weaver::incActiveThreadCount()
void Weaver::setState(ThreadWeaver::StateId)
void Weaver::setState_p(ThreadWeaver::StateId)
ThreadWeaver::JobPointer Weaver::takeFirstAvailableJobOrSuspendOrWait(ThreadWeaver::Thread *th, bool threadWasBusy, bool suspendIfAllThreadsInactive, bool justReturning)
void Weaver::threadEnteredRun(ThreadWeaver::Thread *thread)
[signal]
void Weaver::threadExited(ThreadWeaver::Thread *)
A thread has exited.
[signal]
void Weaver::threadStarted(ThreadWeaver::Thread *)
A Thread has been created.
[signal]
void Weaver::threadSuspended(ThreadWeaver::Thread *)
A thread has been suspended.