summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/thread/qthread_unix.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index a47115cfac..b3040f3dee 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -272,7 +272,9 @@ void QThreadPrivate::createEventDispatcher(QThreadData *data)
void *QThreadPrivate::start(void *arg)
{
+#if !defined(Q_OS_LINUX_ANDROID)
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
+#endif
pthread_cleanup_push(QThreadPrivate::finish, arg);
QThread *thr = reinterpret_cast<QThread *>(arg);
@@ -314,8 +316,10 @@ void *QThreadPrivate::start(void *arg)
#endif
emit thr->started();
+#if !defined(Q_OS_LINUX_ANDROID)
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_testcancel();
+#endif
thr->run();
pthread_cleanup_pop(1);
@@ -617,7 +621,9 @@ void QThread::start(Priority priority)
if (code == EPERM) {
// caller does not have permission to set the scheduling
// parameters/policy
+#if defined(QT_HAS_THREAD_PRIORITY_SCHEDULING)
pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED);
+#endif
code =
pthread_create(&d->thread_id, &attr, QThreadPrivate::start, this);
}
@@ -635,6 +641,7 @@ void QThread::start(Priority priority)
void QThread::terminate()
{
+#if !defined(Q_OS_LINUX_ANDROID)
Q_D(QThread);
QMutexLocker locker(&d->mutex);
@@ -648,6 +655,7 @@ void QThread::terminate()
} else {
d->terminated = true;
}
+#endif
}
bool QThread::wait(unsigned long time)
@@ -677,9 +685,13 @@ void QThread::setTerminationEnabled(bool enabled)
"Current thread was not started with QThread.");
Q_UNUSED(thr)
+#if defined(Q_OS_LINUX_ANDROID)
+ Q_UNUSED(enabled);
+#else
pthread_setcancelstate(enabled ? PTHREAD_CANCEL_ENABLE : PTHREAD_CANCEL_DISABLE, NULL);
if (enabled)
pthread_testcancel();
+#endif
}
void QThread::setPriority(Priority priority)