summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthread_unix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/thread/qthread_unix.cpp')
-rw-r--r--src/corelib/thread/qthread_unix.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index a44a0e811a..e3b587daf8 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -97,6 +97,11 @@
# define SCHED_IDLE 5
#endif
+#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0)
+#define QT_HAS_THREAD_PRIORITY_SCHEDULING
+#endif
+
+
QT_BEGIN_NAMESPACE
#ifndef QT_NO_THREAD
@@ -503,6 +508,7 @@ void QThread::usleep(unsigned long usecs)
thread_sleep(&ti);
}
+#ifdef QT_HAS_THREAD_PRIORITY_SCHEDULING
// Does some magic and calculate the Unix scheduler priorities
// sched_policy is IN/OUT: it must be set to a valid policy before calling this function
// sched_priority is OUT only
@@ -533,6 +539,7 @@ static bool calculateUnixPriority(int priority, int *sched_policy, int *sched_pr
*sched_priority = prio;
return true;
}
+#endif
void QThread::start(Priority priority)
{
@@ -553,7 +560,7 @@ void QThread::start(Priority priority)
d->priority = priority;
-#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && !defined(Q_OS_SYMBIAN) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0)
+#if defined(QT_HAS_THREAD_PRIORITY_SCHEDULING) && !defined(Q_OS_SYMBIAN)
// ### Need to implement thread sheduling and priorities for symbian os. Implementation removed for now
switch (priority) {
case InheritPriority:
@@ -594,7 +601,7 @@ void QThread::start(Priority priority)
break;
}
}
-#endif // _POSIX_THREAD_PRIORITY_SCHEDULING
+#endif // QT_HAS_THREAD_PRIORITY_SCHEDULING
#ifdef Q_OS_SYMBIAN
if (d->stackSize == 0)
@@ -757,7 +764,7 @@ void QThread::setPriority(Priority priority)
// copied from start() with a few modifications:
-#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0)
+#ifdef QT_HAS_THREAD_PRIORITY_SCHEDULING
int sched_policy;
sched_param param;