Changeset 92919 in vbox for trunk/src/VBox/Runtime/r3/posix
- Timestamp:
- Dec 15, 2021 9:50:12 AM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 148875
- Location:
- trunk/src/VBox/Runtime/r3/posix
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/semevent-posix.cpp
r92776 r92919 46 46 #include <unistd.h> 47 47 #include <sys/time.h> 48 49 #ifdef RT_OS_DARWIN 50 # define pthread_yield() pthread_yield_np() 51 #endif 52 53 #if defined(RT_OS_SOLARIS) || defined(RT_OS_HAIKU) || defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD) 54 # include <sched.h> 55 # define pthread_yield() sched_yield() 56 #endif 48 #include <sched.h> 57 49 58 50 #include "semwait.h" … … 351 343 if ( ASMAtomicIncU32(&pThis->cWaiters) > 1 352 344 && pThis->u32State == EVENT_STATE_SIGNALED) 353 pthread_yield();345 sched_yield(); 354 346 355 347 /* take mutex */ … … 438 430 /* for fairness, yield before going to sleep. */ 439 431 if (ASMAtomicIncU32(&pThis->cWaiters) > 1) 440 pthread_yield();432 sched_yield(); 441 433 442 434 /* take mutex */ -
trunk/src/VBox/Runtime/r3/posix/thread2-posix.cpp
r82968 r92919 33 33 #include <pthread.h> 34 34 #include <unistd.h> 35 #if defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD) 36 # include <sched.h> 37 #endif 35 #include <sched.h> 38 36 39 37 #include <iprt/thread.h> … … 58 56 if (!cMillies) 59 57 { 60 /* pthread_yield() isn't part of SuS, thus this fun. */ 61 #ifdef RT_OS_DARWIN 62 pthread_yield_np(); 63 #elif defined(RT_OS_SOLARIS) || defined(RT_OS_HAIKU) || defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD) 64 sched_yield(); 65 #else 66 if (!pthread_yield()) 67 #endif 58 if (!sched_yield()) 68 59 { 69 60 LogFlow(("RTThreadSleep: returning %Rrc (cMillies=%d)\n", VINF_SUCCESS, cMillies)); … … 95 86 if (!cMillies) 96 87 { 97 /* pthread_yield() isn't part of SuS, thus this fun. */ 98 #ifdef RT_OS_DARWIN 99 pthread_yield_np(); 100 #elif defined(RT_OS_SOLARIS) || defined(RT_OS_HAIKU) || defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD) 101 sched_yield(); 102 #else 103 if (!pthread_yield()) 104 #endif 88 if (!sched_yield()) 105 89 return VINF_SUCCESS; 106 90 } … … 125 109 uint64_t u64TS = ASMReadTSC(); 126 110 #endif 127 #ifdef RT_OS_DARWIN 128 pthread_yield_np(); 129 #elif defined(RT_OS_SOLARIS) || defined(RT_OS_HAIKU) || defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD) 111 130 112 sched_yield(); 131 #else 132 pthread_yield(); 133 #endif 113 134 114 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) 135 115 u64TS = ASMReadTSC() - u64TS;
Note:
See TracChangeset
for help on using the changeset viewer.