aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-qt/qt5/qtbase/0008-Replace-pthread_yield-with-sched_yield.patch
blob: 3011f5f2b123a944edcf608ef3f07024aa4602e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
From f3f00676d204b56010d80a1373ad18abe80d455a 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 e312199980..5789174ad5 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>
@@ -205,7 +205,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 263a475435..11994b3c4f 100644
--- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
@@ -78,6 +78,7 @@
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <sched.h>
 #endif
 
 #include "private/qhostinfo_p.h"
@@ -2132,8 +2133,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;