1// qthread.sip generated by MetaSIP
2//
3// This file is part of the QtCore Python extension module.
4//
5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
6//
7// This file is part of PyQt5.
8//
9// This file may be used under the terms of the GNU General Public License
10// version 3.0 as published by the Free Software Foundation and appearing in
11// the file LICENSE included in the packaging of this file.  Please review the
12// following information to ensure the GNU General Public License version 3.0
13// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
14//
15// If you do not wish to use this file under the terms of the GPL version 3.0
16// then you may purchase a commercial license.  For more information contact
17// info@riverbankcomputing.com.
18//
19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21
22
23class QThread : QObject
24{
25%TypeHeaderCode
26#include <qthread.h>
27%End
28
29public:
30    static QThread *currentThread();
31    static Qt::HANDLE currentThreadId();
32    static int idealThreadCount();
33    static void yieldCurrentThread() /ReleaseGIL/;
34    explicit QThread(QObject *parent /TransferThis/ = 0);
35    virtual ~QThread();
36
37    enum Priority
38    {
39        IdlePriority,
40        LowestPriority,
41        LowPriority,
42        NormalPriority,
43        HighPriority,
44        HighestPriority,
45        TimeCriticalPriority,
46        InheritPriority,
47    };
48
49    bool isFinished() const;
50    bool isRunning() const;
51    void setPriority(QThread::Priority priority);
52    QThread::Priority priority() const;
53    void setStackSize(uint stackSize);
54    uint stackSize() const;
55    void exit(int returnCode = 0) /ReleaseGIL/;
56
57public slots:
58    void start(QThread::Priority priority = QThread::InheritPriority) /ReleaseGIL/;
59    void terminate();
60    void quit();
61
62public:
63    bool wait(unsigned long msecs = ULONG_MAX) /ReleaseGIL/;
64%If (Qt_5_15_0 -)
65    bool wait(QDeadlineTimer deadline) [bool (QDeadlineTimer deadline = QDeadlineTimer(QDeadlineTimer::ForeverConstant::Forever))];
66%End
67
68signals:
69    void started();
70    void finished();
71
72protected:
73    virtual void run() /NewThread,ReleaseGIL/;
74    int exec() /PyName=exec_,ReleaseGIL/;
75%If (Py_v3)
76    int exec() /ReleaseGIL/;
77%End
78    static void setTerminationEnabled(bool enabled = true);
79
80public:
81    virtual bool event(QEvent *event);
82    static void sleep(unsigned long) /ReleaseGIL/;
83    static void msleep(unsigned long) /ReleaseGIL/;
84    static void usleep(unsigned long) /ReleaseGIL/;
85    QAbstractEventDispatcher *eventDispatcher() const;
86    void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher /Transfer/);
87%If (Qt_5_2_0 -)
88    void requestInterruption();
89%End
90%If (Qt_5_2_0 -)
91    bool isInterruptionRequested() const;
92%End
93%If (Qt_5_5_0 -)
94    int loopLevel() const;
95%End
96};
97