diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2017-01-02 17:23:14 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-06-22 07:14:29 +0000 |
commit | 31023ef553f3b26081f92a5d95a886f4d7cffdd9 (patch) | |
tree | b720c725dc99aca3bdec5393e616da94fd87570a /src/corelib/thread/qthread_unix.cpp | |
parent | 47aebe3587c7be28ed4fde23b77848657482ed66 (diff) |
Make the sleep methods available in QThread even if QT_NO_THREAD
sleep, msleep, and usleep are not actually related to threading and
serve a purpose also in a single threaded application.
Change-Id: Iba2e343d48a9c09e60125bc1b589047e0241608a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/thread/qthread_unix.cpp')
-rw-r--r-- | src/corelib/thread/qthread_unix.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
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) |