Index: /trunk/include/iprt/mangling.h
===================================================================
--- /trunk/include/iprt/mangling.h	(revision 39442)
+++ /trunk/include/iprt/mangling.h	(revision 39443)
@@ -1468,4 +1468,5 @@
 # define RTThreadSetType                                RT_MANGLER(RTThreadSetType)
 # define RTThreadSleep                                  RT_MANGLER(RTThreadSleep)
+# define RTThreadSleepNoLog                             RT_MANGLER(RTThreadSleepNoLog)
 # define RTThreadStateName                              RT_MANGLER(RTThreadStateName)
 # define RTThreadUnblocked                              RT_MANGLER(RTThreadUnblocked)
Index: /trunk/include/iprt/thread.h
===================================================================
--- /trunk/include/iprt/thread.h	(revision 39442)
+++ /trunk/include/iprt/thread.h	(revision 39443)
@@ -201,4 +201,20 @@
  */
 RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies);
+
+/**
+ * Millisecond granular sleep function, no logger calls.
+ *
+ * Same as RTThreadSleep, except it will never call into the IPRT logger.  It
+ * can therefore safely be used in places where the logger is off limits, like
+ * at termination or init time.  The electric fence heap is one consumer of
+ * this API.
+ *
+ * @returns VINF_SUCCESS on success.
+ * @returns VERR_INTERRUPTED if a signal or other asynchronous stuff happened
+ *          which interrupt the peaceful sleep.
+ * @param   cMillies    Number of milliseconds to sleep.
+ *                      0 milliseconds means yielding the timeslice - deprecated!
+ */
+RTDECL(int) RTThreadSleepNoLog(RTMSINTERVAL cMillies);
 
 /**
Index: /trunk/src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp	(revision 39442)
+++ /trunk/src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp	(revision 39443)
@@ -44,5 +44,5 @@
 
 
-RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)
+static int rtR0ThreadDarwinSleepCommon(RTMSINTERVAL cMillies)
 {
     RT_ASSERT_PREEMPTIBLE();
@@ -51,4 +51,16 @@
     clock_delay_until(u64Deadline);
     return VINF_SUCCESS;
+}
+
+
+RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)
+{
+    return rtR0ThreadDarwinSleepCommon(cMillies);
+}
+
+
+RTDECL(int) RTThreadSleepNoLog(RTMSINTERVAL cMillies)
+{
+    return rtR0ThreadDarwinSleepCommon(cMillies);
 }
 
Index: /trunk/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c
===================================================================
--- /trunk/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c	(revision 39442)
+++ /trunk/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c	(revision 39443)
@@ -46,5 +46,5 @@
 
 
-RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)
+static int rtR0ThreadFbsdSleepCommon(RTMSINTERVAL cMillies)
 {
     int rc;
@@ -97,4 +97,16 @@
             return VERR_NO_TRANSLATION;
     }
+}
+
+
+RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)
+{
+    return rtR0ThreadFbsdSleepCommon(cMillies);
+}
+
+
+RTDECL(int) RTThreadSleepNoLog(RTMSINTERVAL cMillies)
+{
+    return rtR0ThreadFbsdSleepCommon(cMillies);
 }
 
Index: /trunk/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c
===================================================================
--- /trunk/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c	(revision 39442)
+++ /trunk/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c	(revision 39443)
@@ -58,5 +58,5 @@
 
 
-RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)
+static int rtR0ThreadLnxSleepCommon(RTMSINTERVAL cMillies)
 {
     long cJiffies = msecs_to_jiffies(cMillies);
@@ -67,5 +67,18 @@
     return VERR_INTERRUPTED;
 }
+
+
+RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)
+{
+    return rtR0ThreadLnxSleepCommon(cMillies);
+}
 RT_EXPORT_SYMBOL(RTThreadSleep);
+
+
+RTDECL(int) RTThreadSleepNoLog(RTMSINTERVAL cMillies)
+{
+    return rtR0ThreadLnxSleepCommon(cMillies);
+}
+RT_EXPORT_SYMBOL(RTThreadSleepNoLog);
 
 
Index: /trunk/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp	(revision 39442)
+++ /trunk/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp	(revision 39443)
@@ -52,5 +52,5 @@
 
 
-RTDECL(int)   RTThreadSleep(RTMSINTERVAL cMillies)
+static int rtR0ThreadNtSleepCommon(RTMSINTERVAL cMillies)
 {
     LARGE_INTEGER Interval;
@@ -67,4 +67,16 @@
             return RTErrConvertFromNtStatus(rcNt);
     }
+}
+
+
+RTDECL(int)   RTThreadSleep(RTMSINTERVAL cMillies)
+{
+    return rtR0ThreadNtSleepCommon(cMillies);
+}
+
+
+RTDECL(int)   RTThreadSleepCommon(RTMSINTERVAL cMillies)
+{
+    return rtR0ThreadNtSleepCommon(cMillies);
 }
 
Index: /trunk/src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp	(revision 39442)
+++ /trunk/src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp	(revision 39443)
@@ -60,5 +60,5 @@
 
 
-RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)
+static int rtR0ThreadOs2SleepCommon(RTMSINTERVAL cMillies)
 {
     int rc = KernBlock((ULONG)RTThreadSleep,
@@ -77,4 +77,16 @@
             return VERR_NO_TRANSLATION;
     }
+}
+
+
+RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)
+{
+    return rtR0ThreadOs2SleepCommon(cMillies);
+}
+
+
+RTDECL(int) RTThreadSleepNoBlock(RTMSINTERVAL cMillies)
+{
+    return rtR0ThreadOs2SleepCommon(cMillies);
 }
 
Index: /trunk/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c
===================================================================
--- /trunk/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c	(revision 39442)
+++ /trunk/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c	(revision 39443)
@@ -48,5 +48,5 @@
 
 
-RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)
+static int rtR0ThreadSolSleepCommon(RTMSINTERVAL cMillies)
 {
     clock_t cTicks;
@@ -55,5 +55,5 @@
     if (!cMillies)
     {
-        RTThreadYield();
+        vbi_yield();
         return VINF_SUCCESS;
     }
@@ -66,4 +66,16 @@
     delay(cTicks);
     return VINF_SUCCESS;
+}
+
+
+RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)
+{
+    return rtR0ThreadSolSleepCommon(cMillies);
+}
+
+
+RTDECL(int) RTThreadSleepNoLog(RTMSINTERVAL cMillies)
+{
+    return rtR0ThreadSolSleepCommon(cMillies);
 }
 
Index: /trunk/src/VBox/Runtime/r3/alloc-ef.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/alloc-ef.cpp	(revision 39442)
+++ /trunk/src/VBox/Runtime/r3/alloc-ef.cpp	(revision 39443)
@@ -111,5 +111,5 @@
     unsigned c = 0;
     while (!ASMAtomicCmpXchgU32(&g_BlocksLock, 1, 0))
-        RTThreadSleep(((++c) >> 2) & 31);
+        RTThreadSleepNoLog(((++c) >> 2) & 31);
 }
 
Index: /trunk/src/VBox/Runtime/r3/os2/thread-os2.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/os2/thread-os2.cpp	(revision 39442)
+++ /trunk/src/VBox/Runtime/r3/os2/thread-os2.cpp	(revision 39443)
@@ -188,4 +188,11 @@
 
 
+RTDECL(int)   RTThreadSleepNoLog(RTMSINTERVAL cMillies)
+{
+    DosSleep(cMillies);
+    return VINF_SUCCESS;
+}
+
+
 RTDECL(bool) RTThreadYield(void)
 {
Index: /trunk/src/VBox/Runtime/r3/posix/thread2-posix.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/posix/thread2-posix.cpp	(revision 39442)
+++ /trunk/src/VBox/Runtime/r3/posix/thread2-posix.cpp	(revision 39443)
@@ -93,4 +93,35 @@
 
 
+RTDECL(int) RTThreadSleepNoLog(RTMSINTERVAL cMillies)
+{
+    if (!cMillies)
+    {
+        /* 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)
+        sched_yield();
+#else
+        if (!pthread_yield())
+#endif
+            return VINF_SUCCESS;
+    }
+    else
+    {
+        struct timespec ts;
+        struct timespec tsrem = {0,0};
+
+        ts.tv_nsec = (cMillies % 1000) * 1000000;
+        ts.tv_sec  = cMillies / 1000;
+        if (!nanosleep(&ts, &tsrem))
+            return VINF_SUCCESS;
+    }
+
+    return RTErrConvertFromErrno(errno);
+}
+
+
 RTDECL(bool) RTThreadYield(void)
 {
Index: /trunk/src/VBox/Runtime/r3/win/thread2-win.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/win/thread2-win.cpp	(revision 39442)
+++ /trunk/src/VBox/Runtime/r3/win/thread2-win.cpp	(revision 39443)
@@ -56,4 +56,11 @@
 
 
+RTR3DECL(int)   RTThreadSleepNoLog(RTMSINTERVAL cMillies)
+{
+    Sleep(cMillies);
+    return VINF_SUCCESS;
+}
+
+
 RTR3DECL(bool) RTThreadYield(void)
 {
