aboutsummaryrefslogtreecommitdiffstats
path: root/community/virtualbox-guest-additions/musl-sched_yield.patch
blob: 19680e539dfe188bc76d9ef466aceb6a855f4497 (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
61
62
63
64
65
66
67
68
69
70
71
--- ./src/VBox/Runtime/r3/posix/thread2-posix.cpp.orig
+++ ./src/VBox/Runtime/r3/posix/thread2-posix.cpp
@@ -63,7 +63,7 @@
 #elif defined(RT_OS_SOLARIS) || defined(RT_OS_HAIKU) || defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD)
         sched_yield();
 #else
-        if (!pthread_yield())
+        if (!sched_yield())
 #endif
         {
             LogFlow(("RTThreadSleep: returning %Rrc (cMillies=%d)\n", VINF_SUCCESS, cMillies));
@@ -100,7 +100,7 @@
 #elif defined(RT_OS_SOLARIS) || defined(RT_OS_HAIKU) || defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD)
         sched_yield();
 #else
-        if (!pthread_yield())
+        if (!sched_yield())
 #endif
             return VINF_SUCCESS;
     }
@@ -126,10 +126,8 @@
 #endif
 #ifdef RT_OS_DARWIN
     pthread_yield_np();
-#elif defined(RT_OS_SOLARIS) || defined(RT_OS_HAIKU) || defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD)
-    sched_yield();
 #else
-    pthread_yield();
+    sched_yield();
 #endif
 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     u64TS = ASMReadTSC() - u64TS;
diff --git a/src/VBox/Runtime/r3/posix/semevent-posix.cpp b/src/VBox/Runtime/r3/posix/semevent-posix.cpp
index 80d5747..4f70841 100644
--- a/src/VBox/Runtime/r3/posix/semevent-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/semevent-posix.cpp
@@ -44,15 +44,7 @@
 #include <pthread.h>
 #include <unistd.h>
 #include <sys/time.h>
-
-#ifdef RT_OS_DARWIN
-# define pthread_yield() pthread_yield_np()
-#endif
-
-#if defined(RT_OS_SOLARIS) || defined(RT_OS_HAIKU) || defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD)
-# include <sched.h>
-# define pthread_yield() sched_yield()
-#endif
+#include <sched.h>
 
 
 /*********************************************************************************************************************************
@@ -317,7 +309,7 @@ DECL_FORCE_INLINE(int) rtSemEventWait(RTSEMEVENT hEventSem, RTMSINTERVAL cMillie
         /* for fairness, yield before going to sleep. */
         if (    ASMAtomicIncU32(&pThis->cWaiters) > 1
             &&  pThis->u32State == EVENT_STATE_SIGNALED)
-            pthread_yield();
+            sched_yield();
 
          /* take mutex */
         int rc = pthread_mutex_lock(&pThis->Mutex);
@@ -405,7 +397,7 @@ DECL_FORCE_INLINE(int) rtSemEventWait(RTSEMEVENT hEventSem, RTMSINTERVAL cMillie
 
         /* for fairness, yield before going to sleep. */
         if (ASMAtomicIncU32(&pThis->cWaiters) > 1 && cMillies)
-            pthread_yield();
+            sched_yield();
 
         /* take mutex */
         int rc = pthread_mutex_lock(&pThis->Mutex);