summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/thread/qthread.h4
-rw-r--r--src/corelib/thread/qthread_unix.cpp4
-rw-r--r--src/corelib/thread/qthread_win.cpp10
3 files changed, 16 insertions, 2 deletions
diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h
index 3df76077e1..19951e844a 100644
--- a/src/corelib/thread/qthread.h
+++ b/src/corelib/thread/qthread.h
@@ -247,6 +247,10 @@ public:
static Qt::HANDLE currentThreadId() { return Qt::HANDLE(currentThread()); }
static QThread* currentThread();
+ static void sleep(unsigned long);
+ static void msleep(unsigned long);
+ static void usleep(unsigned long);
+
protected:
QThread(QThreadPrivate &dd, QObject *parent = nullptr);
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index 9ad32b162d..c5de46d07d 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -519,6 +519,8 @@ void QThread::yieldCurrentThread()
sched_yield();
}
+#endif // QT_NO_THREAD
+
static timespec makeTimespec(time_t secs, long nsecs)
{
struct timespec ts;
@@ -542,6 +544,8 @@ void QThread::usleep(unsigned long usecs)
qt_nanosleep(makeTimespec(usecs / 1000 / 1000, usecs % (1000*1000) * 1000));
}
+#ifndef QT_NO_THREAD
+
#ifdef QT_HAS_THREAD_PRIORITY_SCHEDULING
#if defined(Q_OS_QNX)
static bool calculateUnixPriority(int priority, int *sched_policy, int *sched_priority)
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp
index 4459ae87af..6c9f939b7d 100644
--- a/src/corelib/thread/qthread_win.cpp
+++ b/src/corelib/thread/qthread_win.cpp
@@ -61,9 +61,10 @@
# include <process.h>
#endif // Q_OS_WINRT
-#ifndef QT_NO_THREAD
QT_BEGIN_NAMESPACE
+#ifndef QT_NO_THREAD
+
#ifdef Q_OS_WINRT
inline DWORD qWinRTTlsAlloc() {
return FlsAlloc(0);
@@ -449,6 +450,8 @@ void QThread::yieldCurrentThread()
#endif
}
+#endif // QT_NO_THREAD
+
void QThread::sleep(unsigned long secs)
{
::Sleep(secs * 1000);
@@ -464,6 +467,8 @@ void QThread::usleep(unsigned long usecs)
::Sleep((usecs / 1000) + 1);
}
+#ifndef QT_NO_THREAD
+
void QThread::start(Priority priority)
{
Q_D(QThread);
@@ -700,5 +705,6 @@ void QThreadPrivate::setPriority(QThread::Priority threadPriority)
}
}
-QT_END_NAMESPACE
#endif // QT_NO_THREAD
+
+QT_END_NAMESPACE