qthread.sip 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. // qthread.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtCore Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  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. class QThread : public QObject
  22. {
  23. %TypeHeaderCode
  24. #include <qthread.h>
  25. %End
  26. public:
  27. static QThread *currentThread();
  28. static Qt::HANDLE currentThreadId();
  29. static int idealThreadCount();
  30. static void yieldCurrentThread() /ReleaseGIL/;
  31. explicit QThread(QObject *parent /TransferThis/ = 0);
  32. virtual ~QThread();
  33. enum Priority
  34. {
  35. IdlePriority,
  36. LowestPriority,
  37. LowPriority,
  38. NormalPriority,
  39. HighPriority,
  40. HighestPriority,
  41. TimeCriticalPriority,
  42. InheritPriority,
  43. };
  44. bool isFinished() const;
  45. bool isRunning() const;
  46. void setPriority(QThread::Priority priority);
  47. QThread::Priority priority() const;
  48. void setStackSize(uint stackSize);
  49. uint stackSize() const;
  50. void exit(int returnCode = 0) /ReleaseGIL/;
  51. public slots:
  52. void start(QThread::Priority priority = QThread::InheritPriority) /ReleaseGIL/;
  53. void terminate();
  54. void quit();
  55. public:
  56. bool wait(QDeadlineTimer deadline = QDeadlineTimer(QDeadlineTimer::Forever)) /ReleaseGIL/;
  57. bool wait(unsigned long time) /ReleaseGIL/;
  58. signals:
  59. void started();
  60. void finished();
  61. protected:
  62. virtual void run() /NewThread,ReleaseGIL/;
  63. int exec() /ReleaseGIL/;
  64. static void setTerminationEnabled(bool enabled = true);
  65. public:
  66. virtual bool event(QEvent *event);
  67. static void sleep(unsigned long) /ReleaseGIL/;
  68. static void msleep(unsigned long) /ReleaseGIL/;
  69. static void usleep(unsigned long) /ReleaseGIL/;
  70. QAbstractEventDispatcher *eventDispatcher() const;
  71. void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher /Transfer/);
  72. void requestInterruption();
  73. bool isInterruptionRequested() const;
  74. int loopLevel() const;
  75. %If (Qt_6_8_0 -)
  76. static bool isMainThread();
  77. %End
  78. %If (Qt_6_8_0 -)
  79. bool isCurrentThread() const;
  80. %End
  81. %If (Qt_6_9_0 -)
  82. enum class QualityOfService
  83. {
  84. Auto,
  85. High,
  86. Eco,
  87. };
  88. %End
  89. %If (Qt_6_9_0 -)
  90. void setServiceLevel(QThread::QualityOfService serviceLevel);
  91. %End
  92. %If (Qt_6_9_0 -)
  93. QThread::QualityOfService serviceLevel() const;
  94. %End
  95. };