[oe,meta-qt5,1/2] qtbase: Use sched_yield instead of pthread_yield

Message ID 20170802025523.37417-1-raj.khem@gmail.com
State New
Headers show
Series
  • [oe,meta-qt5,1/2] qtbase: Use sched_yield instead of pthread_yield
Related show

Commit Message

Khem Raj Aug. 2, 2017, 2:55 a.m.
Makes it portable across glibc and musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 ...11-Replace-pthread_yield-with-sched_yield.patch | 63 ++++++++++++++++++++++
 recipes-qt/qt5/qtbase_git.bb                       |  1 +
 2 files changed, 64 insertions(+)
 create mode 100644 recipes-qt/qt5/qtbase/0011-Replace-pthread_yield-with-sched_yield.patch

-- 
2.13.3

-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

Patch

diff --git a/recipes-qt/qt5/qtbase/0011-Replace-pthread_yield-with-sched_yield.patch b/recipes-qt/qt5/qtbase/0011-Replace-pthread_yield-with-sched_yield.patch
new file mode 100644
index 0000000..ed0d4bc
--- /dev/null
+++ b/recipes-qt/qt5/qtbase/0011-Replace-pthread_yield-with-sched_yield.patch
@@ -0,0 +1,63 @@ 
+From d1d4b520e29b58e427fc7bd336d34b82d0d2b1f3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+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 <raj.khem@gmail.com>
+---
+ 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 7d9f56ef38..bc115ef61d 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 <pthread.h>
++# include <sched.h>
+ #endif
+ 
+ #include <algorithm>
+@@ -197,7 +197,7 @@ protected:
+             const char *nm = name.constData();
+             int tp = qRegisterMetaType<Bar>(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 fe1057bdde..e23e97b259 100644
+--- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
++++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
+@@ -75,6 +75,7 @@
+ #include <stdlib.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
++#include <sched.h>
+ #endif
+ 
+ #include "private/qhostinfo_p.h"
+@@ -2129,8 +2130,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;
+-- 
+2.13.3
+
diff --git a/recipes-qt/qt5/qtbase_git.bb b/recipes-qt/qt5/qtbase_git.bb
index c26a93b..9e652c3 100644
--- a/recipes-qt/qt5/qtbase_git.bb
+++ b/recipes-qt/qt5/qtbase_git.bb
@@ -24,6 +24,7 @@  SRC_URI += "\
     file://0009-Disable-all-unknown-features-instead-of-erroring-out.patch \
     file://0010-Pretend-Qt5-wasn-t-found-if-OE_QMAKE_PATH_EXTERNAL_H.patch \
     file://0010-tst_qstring-Disable-Wformat-security-with-clang-as-w.patch \
+    file://0011-Replace-pthread_yield-with-sched_yield.patch \
 "
 
 # only for target qtbase