ThreadWeaver 5.109.0
thread.h
1/* -*- C++ -*-
2 This file is part of ThreadWeaver. It declares the Thread class.
3
4 SPDX-FileCopyrightText: 2004-2013 Mirko Boehm <mirko@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#ifndef THREADWEAVER_THREAD_H
10#define THREADWEAVER_THREAD_H
11
12#include <QMutex>
13#include <QThread>
14
15#include "jobpointer.h"
16#include "threadweaver_export.h"
17
18namespace ThreadWeaver
19{
20class Job;
21class Weaver;
22
27class THREADWEAVER_EXPORT Thread : public QThread
28{
29 Q_OBJECT
30public:
35 explicit Thread(Weaver *parent = nullptr);
36
38 ~Thread() override;
39
45 void run() override;
46
53 unsigned int id() const;
54
61
62Q_SIGNALS:
63#if THREADWEAVER_ENABLE_DEPRECATED_SINCE(5, 80)
69 THREADWEAVER_DEPRECATED_VERSION(5, 80, "Use the QThread::started() signal")
70 void started(ThreadWeaver::Thread *); // clazy:exclude=overloaded-signal
71#endif
72
73private:
74 class Private;
75 Private *const d;
76};
77
78}
79
80#endif
Thread represents a worker thread in a Queue's inventory.
Definition thread.h:28
Thread(Weaver *parent=nullptr)
Create a thread.
void run() override
The run method is reimplemented to execute jobs from the queue.
~Thread() override
The destructor.
void requestAbort()
Request the abortion of the job that is processed currently.
unsigned int id() const
Returns the thread id.
A Weaver manages worker threads.
Definition weaver.h:35