Permalink
Browse files

Isolated none-existing posix threading functions on Android

  • Loading branch information...
sgeto committed Mar 3, 2017
1 parent 82ed99b commit 4e25f081847cf2717ad561214e90d9750da5a511
Showing with 8 additions and 1 deletion.
  1. +8 −1 qtools/qthread_unix.cpp
@@ -76,14 +76,18 @@ QThreadPrivate::~QThreadPrivate()
void *QThreadPrivate::start(void *arg)
{
#ifndef __ANDROID__
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
#endif
pthread_cleanup_push(QThreadPrivate::finish, arg);
QThread *thr = reinterpret_cast<QThread *>(arg);
thr->started();
#ifndef __ANDROID__
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_testcancel();
#endif
thr->run();
pthread_cleanup_pop(1);
@@ -132,7 +136,9 @@ void QThread::start()
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED);
#ifndef __ANDROID__
pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED);
#endif
if (d->stackSize>0)
{
#if defined(_POSIX_THREAD_ATTR_STACKSIZE) && (_POSIX_THREAD_ATTR_STACKSIZE-0>0)
@@ -160,7 +166,7 @@ void QThread::start()
void QThread::terminate()
{
QMutexLocker locker(&d->mutex);
#ifndef __ANDROID__
if (!d->thread_id) return;
int code = pthread_cancel(d->thread_id);
@@ -172,6 +178,7 @@ void QThread::terminate()
{
d->terminated = TRUE;
}
#endif
}
void QThread::wait()

0 comments on commit 4e25f08

Please sign in to comment.