On 08/01/16 08:45 PM, Valery Ushakov wrote:
> Kamil Rytarowski <n...@gmx.com> wrote:
> 
>> NetBSD ships with sched_yield(3)
> 
> This patch misses two other places where sched_yield() is tested for.
> Applied with all cases covered.
> 
> PS: Please, don't include blank line changes in your diffs.  Either
> tell your editor to not "fix" trailing blank lines or manually delete
> such hunks.
While we are at it, FreeBSD can switch to sched_yield(2) to reduce
#ifdef's.  FYI, pthread_yield(3) is just a wrapper around sched_yield()
for all supported versions.

Jung-uk Kim
--- src/VBox/Runtime/r3/posix/thread2-posix.cpp.orig	2016-07-18 11:57:00.000000000 +0000
+++ src/VBox/Runtime/r3/posix/thread2-posix.cpp	2016-08-02 17:53:44.591059000 +0000
@@ -32,7 +32,7 @@
 #include <errno.h>
 #include <pthread.h>
 #include <unistd.h>
-#if defined(RT_OS_SOLARIS)
+#if defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD) || defined(RT_OS_SOLARIS)
 # include <sched.h>
 #endif
 
@@ -60,9 +60,7 @@ RTDECL(int) RTThreadSleep(RTMSINTERVAL c
         /* pthread_yield() isn't part of SuS, thus this fun. */
 #ifdef RT_OS_DARWIN
         pthread_yield_np();
-#elif defined(RT_OS_FREEBSD) /* void pthread_yield */
-        pthread_yield();
-#elif defined(RT_OS_SOLARIS) || defined(RT_OS_HAIKU)
+#elif defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD) || defined(RT_OS_SOLARIS) || defined(RT_OS_HAIKU)
         sched_yield();
 #else
         if (!pthread_yield())
@@ -99,9 +97,7 @@ RTDECL(int) RTThreadSleepNoLog(RTMSINTER
         /* pthread_yield() isn't part of SuS, thus this fun. */
 #ifdef RT_OS_DARWIN
         pthread_yield_np();
-#elif defined(RT_OS_FREEBSD) /* void pthread_yield */
-        pthread_yield();
-#elif defined(RT_OS_SOLARIS) || defined(RT_OS_HAIKU)
+#elif defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD) || defined(RT_OS_SOLARIS) || defined(RT_OS_HAIKU)
         sched_yield();
 #else
         if (!pthread_yield())
@@ -130,7 +126,7 @@ RTDECL(bool) RTThreadYield(void)
 #endif
 #ifdef RT_OS_DARWIN
     pthread_yield_np();
-#elif defined(RT_OS_SOLARIS) || defined(RT_OS_HAIKU)
+#elif defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD) || defined(RT_OS_SOLARIS) || defined(RT_OS_HAIKU)
     sched_yield();
 #else
     pthread_yield();

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
vbox-dev mailing list
vbox-dev@virtualbox.org
https://www.virtualbox.org/mailman/listinfo/vbox-dev

Reply via email to