Changeset 39443 in vbox
- Timestamp:
- Nov 28, 2011 3:01:21 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 75079
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/mangling.h
r39378 r39443 1468 1468 # define RTThreadSetType RT_MANGLER(RTThreadSetType) 1469 1469 # define RTThreadSleep RT_MANGLER(RTThreadSleep) 1470 # define RTThreadSleepNoLog RT_MANGLER(RTThreadSleepNoLog) 1470 1471 # define RTThreadStateName RT_MANGLER(RTThreadStateName) 1471 1472 # define RTThreadUnblocked RT_MANGLER(RTThreadUnblocked) -
trunk/include/iprt/thread.h
r37154 r39443 201 201 */ 202 202 RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies); 203 204 /** 205 * Millisecond granular sleep function, no logger calls. 206 * 207 * Same as RTThreadSleep, except it will never call into the IPRT logger. It 208 * can therefore safely be used in places where the logger is off limits, like 209 * at termination or init time. The electric fence heap is one consumer of 210 * this API. 211 * 212 * @returns VINF_SUCCESS on success. 213 * @returns VERR_INTERRUPTED if a signal or other asynchronous stuff happened 214 * which interrupt the peaceful sleep. 215 * @param cMillies Number of milliseconds to sleep. 216 * 0 milliseconds means yielding the timeslice - deprecated! 217 */ 218 RTDECL(int) RTThreadSleepNoLog(RTMSINTERVAL cMillies); 203 219 204 220 /** -
trunk/src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp
r28800 r39443 44 44 45 45 46 RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)46 static int rtR0ThreadDarwinSleepCommon(RTMSINTERVAL cMillies) 47 47 { 48 48 RT_ASSERT_PREEMPTIBLE(); … … 51 51 clock_delay_until(u64Deadline); 52 52 return VINF_SUCCESS; 53 } 54 55 56 RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies) 57 { 58 return rtR0ThreadDarwinSleepCommon(cMillies); 59 } 60 61 62 RTDECL(int) RTThreadSleepNoLog(RTMSINTERVAL cMillies) 63 { 64 return rtR0ThreadDarwinSleepCommon(cMillies); 53 65 } 54 66 -
trunk/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c
r35960 r39443 46 46 47 47 48 RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)48 static int rtR0ThreadFbsdSleepCommon(RTMSINTERVAL cMillies) 49 49 { 50 50 int rc; … … 97 97 return VERR_NO_TRANSLATION; 98 98 } 99 } 100 101 102 RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies) 103 { 104 return rtR0ThreadFbsdSleepCommon(cMillies); 105 } 106 107 108 RTDECL(int) RTThreadSleepNoLog(RTMSINTERVAL cMillies) 109 { 110 return rtR0ThreadFbsdSleepCommon(cMillies); 99 111 } 100 112 -
trunk/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c
r33358 r39443 58 58 59 59 60 RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)60 static int rtR0ThreadLnxSleepCommon(RTMSINTERVAL cMillies) 61 61 { 62 62 long cJiffies = msecs_to_jiffies(cMillies); … … 67 67 return VERR_INTERRUPTED; 68 68 } 69 70 71 RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies) 72 { 73 return rtR0ThreadLnxSleepCommon(cMillies); 74 } 69 75 RT_EXPORT_SYMBOL(RTThreadSleep); 76 77 78 RTDECL(int) RTThreadSleepNoLog(RTMSINTERVAL cMillies) 79 { 80 return rtR0ThreadLnxSleepCommon(cMillies); 81 } 82 RT_EXPORT_SYMBOL(RTThreadSleepNoLog); 70 83 71 84 -
trunk/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp
r30359 r39443 52 52 53 53 54 RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)54 static int rtR0ThreadNtSleepCommon(RTMSINTERVAL cMillies) 55 55 { 56 56 LARGE_INTEGER Interval; … … 67 67 return RTErrConvertFromNtStatus(rcNt); 68 68 } 69 } 70 71 72 RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies) 73 { 74 return rtR0ThreadNtSleepCommon(cMillies); 75 } 76 77 78 RTDECL(int) RTThreadSleepCommon(RTMSINTERVAL cMillies) 79 { 80 return rtR0ThreadNtSleepCommon(cMillies); 69 81 } 70 82 -
trunk/src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp
r33393 r39443 60 60 61 61 62 RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)62 static int rtR0ThreadOs2SleepCommon(RTMSINTERVAL cMillies) 63 63 { 64 64 int rc = KernBlock((ULONG)RTThreadSleep, … … 77 77 return VERR_NO_TRANSLATION; 78 78 } 79 } 80 81 82 RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies) 83 { 84 return rtR0ThreadOs2SleepCommon(cMillies); 85 } 86 87 88 RTDECL(int) RTThreadSleepNoBlock(RTMSINTERVAL cMillies) 89 { 90 return rtR0ThreadOs2SleepCommon(cMillies); 79 91 } 80 92 -
trunk/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c
r29281 r39443 48 48 49 49 50 RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)50 static int rtR0ThreadSolSleepCommon(RTMSINTERVAL cMillies) 51 51 { 52 52 clock_t cTicks; … … 55 55 if (!cMillies) 56 56 { 57 RTThreadYield();57 vbi_yield(); 58 58 return VINF_SUCCESS; 59 59 } … … 66 66 delay(cTicks); 67 67 return VINF_SUCCESS; 68 } 69 70 71 RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies) 72 { 73 return rtR0ThreadSolSleepCommon(cMillies); 74 } 75 76 77 RTDECL(int) RTThreadSleepNoLog(RTMSINTERVAL cMillies) 78 { 79 return rtR0ThreadSolSleepCommon(cMillies); 68 80 } 69 81 -
trunk/src/VBox/Runtime/r3/alloc-ef.cpp
r39091 r39443 111 111 unsigned c = 0; 112 112 while (!ASMAtomicCmpXchgU32(&g_BlocksLock, 1, 0)) 113 RTThreadSleep (((++c) >> 2) & 31);113 RTThreadSleepNoLog(((++c) >> 2) & 31); 114 114 } 115 115 -
trunk/src/VBox/Runtime/r3/os2/thread-os2.cpp
r37154 r39443 188 188 189 189 190 RTDECL(int) RTThreadSleepNoLog(RTMSINTERVAL cMillies) 191 { 192 DosSleep(cMillies); 193 return VINF_SUCCESS; 194 } 195 196 190 197 RTDECL(bool) RTThreadYield(void) 191 198 { -
trunk/src/VBox/Runtime/r3/posix/thread2-posix.cpp
r37733 r39443 93 93 94 94 95 RTDECL(int) RTThreadSleepNoLog(RTMSINTERVAL cMillies) 96 { 97 if (!cMillies) 98 { 99 /* pthread_yield() isn't part of SuS, thus this fun. */ 100 #ifdef RT_OS_DARWIN 101 pthread_yield_np(); 102 #elif defined(RT_OS_FREEBSD) /* void pthread_yield */ 103 pthread_yield(); 104 #elif defined(RT_OS_SOLARIS) 105 sched_yield(); 106 #else 107 if (!pthread_yield()) 108 #endif 109 return VINF_SUCCESS; 110 } 111 else 112 { 113 struct timespec ts; 114 struct timespec tsrem = {0,0}; 115 116 ts.tv_nsec = (cMillies % 1000) * 1000000; 117 ts.tv_sec = cMillies / 1000; 118 if (!nanosleep(&ts, &tsrem)) 119 return VINF_SUCCESS; 120 } 121 122 return RTErrConvertFromErrno(errno); 123 } 124 125 95 126 RTDECL(bool) RTThreadYield(void) 96 127 { -
trunk/src/VBox/Runtime/r3/win/thread2-win.cpp
r39327 r39443 56 56 57 57 58 RTR3DECL(int) RTThreadSleepNoLog(RTMSINTERVAL cMillies) 59 { 60 Sleep(cMillies); 61 return VINF_SUCCESS; 62 } 63 64 58 65 RTR3DECL(bool) RTThreadYield(void) 59 66 {
Note:
See TracChangeset
for help on using the changeset viewer.