From 08d705e3a5e16ba75b0ca281400bba0d85f64f77 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Thu, 27 Jul 2017 08:02:51 -0700 Subject: [PATCH] Replace pthread_yield with sched_yield On Linux pthead_yield is same as sched_yield implementation wise and sched_yield is available on all libc implementations on Linux Signed-off-by: Khem Raj --- tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp | 4 ++-- tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index f9ddd59..2f92db9 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -34,7 +34,7 @@ #include "tst_qvariant_common.h" #ifdef Q_OS_LINUX -# include +# include #endif #include @@ -197,7 +197,7 @@ protected: const char *nm = name.constData(); int tp = qRegisterMetaType(nm); #if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) - pthread_yield(); + sched_yield(); #endif QMetaType info(tp); if (!info.isValid()) { diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index f64a88c..997218b 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -77,6 +77,7 @@ #include #include #include +#include #endif #include "private/qhostinfo_p.h" @@ -2138,8 +2139,8 @@ public slots: #if defined(Q_OS_MAC) pthread_yield_np(); -#elif defined Q_OS_LINUX && !defined Q_OS_ANDROID - pthread_yield(); +#elif defined Q_OS_LINUX + sched_yield(); #endif if (!sock->waitForConnected()) { networkTimeout = true;