ThreadWeaver 5.109.0
Signals | Public Member Functions | List of all members
ThreadWeaver::Thread

Thread represents a worker thread in a Queue's inventory. More...

#include <thread.h>

Signals

void started (ThreadWeaver::Thread *)
 The thread has been started.
 

Public Member Functions

 Thread (Weaver *parent=nullptr)
 Create a thread.
 
 ~Thread () override
 The destructor.
 
unsigned int id () const
 Returns the thread id.
 
void requestAbort ()
 Request the abortion of the job that is processed currently.
 
void run () override
 The run method is reimplemented to execute jobs from the queue.
 

Detailed Description

Thread represents a worker thread in a Queue's inventory.

Threads are created and managed by queues on demand. A Thread will try to retrieve and process jobs from the queue until it is told to exit.

Constructor & Destructor Documentation

◆ Thread()

ThreadWeaver::Thread::Thread ( Weaver parent = nullptr)
explicit

Create a thread.

Parameters
parentthe parent Weaver

◆ ~Thread()

ThreadWeaver::Thread::~Thread ( )
override

The destructor.

Member Function Documentation

◆ id()

unsigned int ThreadWeaver::Thread::id ( ) const

Returns the thread id.

This id marks the respective Thread object, and must therefore not be confused with, e.g., the pthread thread ID. The way threads are implemented and identified is platform specific. id() is the only way to uniquely identify a thread within ThreadWeaver.

◆ requestAbort()

void ThreadWeaver::Thread::requestAbort ( )

Request the abortion of the job that is processed currently.

If there is no current job, this method will do nothing, but can safely be called. It forwards the request to the current Job.

◆ run()

void ThreadWeaver::Thread::run ( )
override

The run method is reimplemented to execute jobs from the queue.

Whenever the thread is idle, it will ask its Weaver parent for a Job to do. The Weaver will either return a Job or a null pointer. When a null pointer is returned, it tells the thread to exit.

◆ started

void ThreadWeaver::Thread::started ( ThreadWeaver::Thread )
signal

The thread has been started.

Deprecated:
since 5.80, use the QThread::started() signal