Index: /trunk/include/iprt/semaphore.h
===================================================================
--- /trunk/include/iprt/semaphore.h	(revision 25619)
+++ /trunk/include/iprt/semaphore.h	(revision 25620)
@@ -491,4 +491,44 @@
  */
 RTDECL(int)   RTSemRWRequestReadNoResume(RTSEMRW RWSem, unsigned cMillies);
+
+/**
+ * Debug version of RTSemRWRequestRead that tracks the location.
+ *
+ * @returns iprt status code.
+ * @retval  VINF_SUCCESS on success.
+ * @retval  VERR_INTERRUPT if the wait was interrupted.
+ * @retval  VERR_INVALID_HANDLE if RWSem is invalid.
+ *
+ * @param   RWSem       The Read/Write semaphore to request read access to.
+ * @param   cMillies    The number of milliseconds to wait.
+ * @param   uId                 Some kind of locking location ID.  Typically a
+ *                              return address up the stack.  Optional (0).
+ * @param   pszFile             The file where the lock is being acquired from.
+ *                              Optional.
+ * @param   iLine               The line number in that file.  Optional (0).
+ * @param   pszFunction         The functionn where the lock is being acquired
+ *                              from.  Optional.
+ */
+RTDECL(int)   RTSemRWRequestReadDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
+
+/**
+ * Debug version of RTSemRWRequestWriteNoResume that tracks the location.
+ *
+ * @returns iprt status code.
+ * @retval  VINF_SUCCESS on success.
+ * @retval  VERR_INTERRUPT if the wait was interrupted.
+ * @retval  VERR_INVALID_HANDLE if RWSem is invalid.
+ *
+ * @param   RWSem       The Read/Write semaphore to request read access to.
+ * @param   cMillies    The number of milliseconds to wait.
+ * @param   uId                 Some kind of locking location ID.  Typically a
+ *                              return address up the stack.  Optional (0).
+ * @param   pszFile             The file where the lock is being acquired from.
+ *                              Optional.
+ * @param   iLine               The line number in that file.  Optional (0).
+ * @param   pszFunction         The functionn where the lock is being acquired
+ *                              from.  Optional.
+ */
+RTDECL(int)   RTSemRWRequestReadNoResumeDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
 
 /**
@@ -605,4 +645,19 @@
  */
 RTDECL(uint32_t) RTSemRWGetReadCount(RTSEMRW RWSem);
+
+/* Strict build: Remap the four request calls to the debug versions. */
+#ifdef RT_STRICT
+# ifdef ___iprt_asm_h
+#  define RTSemRWRequestRead(pCritSect, cMillies)           RTSemRWRequestReadDebug((pCritSect), (cMillies), (uintptr_t)ASMReturnAddress(), RT_SRC_POS)
+#  define RTSemRWRequestReadNoResume(pCritSect, cMillies)   RTSemRWRequestReadNoResumeDebug((pCritSect), (cMillies), (uintptr_t)ASMReturnAddress(), RT_SRC_POS)
+#  define RTSemRWRequestWrite(pCritSect, cMillies)          RTSemRWRequestWriteDebug((pCritSect), (cMillies), (uintptr_t)ASMReturnAddress(), RT_SRC_POS)
+#  define RTSemRWRequestWriteNoResume(pCritSect, cMillies)  RTSemRWRequestWriteNoResumeDebug((pCritSect), (cMillies), (uintptr_t)ASMReturnAddress(), RT_SRC_POS)
+# else
+#  define RTSemRWRequestRead(pCritSect, cMillies)           RTSemRWRequestReadDebug((pCritSect), (cMillies), 0, RT_SRC_POS)
+#  define RTSemRWRequestReadNoResume(pCritSect, cMillies)   RTSemRWRequestReadNoResumeDebug((pCritSect), (cMillies), 0, RT_SRC_POS)
+#  define RTSemRWRequestWrite(pCritSect, cMillies)          RTSemRWRequestWriteDebug((pCritSect), (cMillies), 0, RT_SRC_POS)
+#  define RTSemRWRequestWriteNoResume(pCritSect, cMillies)  RTSemRWRequestWriteNoResumeDebug((pCritSect), (cMillies), 0, RT_SRC_POS)
+# endif
+#endif
 
 /** @} */
Index: /trunk/src/VBox/Runtime/generic/semrw-generic.cpp
===================================================================
--- /trunk/src/VBox/Runtime/generic/semrw-generic.cpp	(revision 25619)
+++ /trunk/src/VBox/Runtime/generic/semrw-generic.cpp	(revision 25620)
@@ -91,4 +91,10 @@
 
 
+/* No debug wrapping here. */
+#undef RTSemRWRequestRead
+#undef RTSemRWRequestReadNoResume
+#undef RTSemRWRequestWrite
+#undef RTSemRWRequestWriteNoResume
+
 
 RTDECL(int) RTSemRWCreate(PRTSEMRW pRWSem)
@@ -217,8 +223,6 @@
 
 
-RTDECL(int) RTSemRWRequestRead(RTSEMRW RWSem, unsigned cMillies)
-{
-    PRTLOCKVALSRCPOS        pSrcPos = NULL;
-
+DECL_FORCE_INLINE(int) rtSemRWRequestRead(RTSEMRW RWSem, unsigned cMillies, bool fInterruptible, PCRTLOCKVALSRCPOS pSrcPos)
+{
     /*
      * Validate handle.
@@ -326,5 +330,9 @@
         RTThreadBlocking(hThreadSelf, RTTHREADSTATE_RW_READ);
 #endif
-        int rcWait = rc = RTSemEventMultiWait(pThis->ReadEvent, cMillies);
+        int rcWait;
+        if (fInterruptible)
+            rcWait = rc = RTSemEventMultiWaitNoResume(pThis->ReadEvent, cMillies);
+        else
+            rcWait = rc = RTSemEventMultiWait(pThis->ReadEvent, cMillies);
         RTThreadUnblocked(hThreadSelf, RTTHREADSTATE_RW_READ);
         if (RT_FAILURE(rc) && rc != VERR_TIMEOUT) /* handle timeout below */
@@ -382,12 +390,44 @@
     return rc;
 }
+
+
+RTDECL(int) RTSemRWRequestRead(RTSEMRW RWSem, unsigned cMillies)
+{
+#ifndef RTSEMRW_STRICT
+    return rtSemRWRequestRead(RWSem, cMillies, false, NULL);
+#else
+    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
+    return rtSemRWRequestRead(RWSem, cMillies, false, &SrcPos);
+#endif
+}
 RT_EXPORT_SYMBOL(RTSemRWRequestRead);
 
 
+RTDECL(int) RTSemRWRequestReadDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
+{
+    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
+    return rtSemRWRequestRead(RWSem, cMillies, false, &SrcPos);
+}
+RT_EXPORT_SYMBOL(RTSemRWRequestReadDebug);
+
+
 RTDECL(int) RTSemRWRequestReadNoResume(RTSEMRW RWSem, unsigned cMillies)
 {
-    return RTSemRWRequestRead(RWSem, cMillies);
+#ifndef RTSEMRW_STRICT
+    return rtSemRWRequestRead(RWSem, cMillies, true, NULL);
+#else
+    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
+    return rtSemRWRequestRead(RWSem, cMillies, true, &SrcPos);
+#endif
 }
 RT_EXPORT_SYMBOL(RTSemRWRequestReadNoResume);
+
+
+RTDECL(int) RTSemRWRequestReadNoResumeDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
+{
+    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
+    return rtSemRWRequestRead(RWSem, cMillies, true, &SrcPos);
+}
+RT_EXPORT_SYMBOL(RTSemRWRequestReadNoResumeDebug);
 
 
@@ -472,8 +512,6 @@
 
 
-RTDECL(int) RTSemRWRequestWrite(RTSEMRW RWSem, unsigned cMillies)
-{
-    PRTLOCKVALSRCPOS        pSrcPos = NULL;
-
+DECL_FORCE_INLINE(int) rtSemRWRequestWrite(RTSEMRW RWSem, unsigned cMillies, bool fInterruptible, PCRTLOCKVALSRCPOS pSrcPos)
+{
     /*
      * Validate handle.
@@ -580,5 +618,9 @@
         RTThreadBlocking(hThreadSelf, RTTHREADSTATE_RW_WRITE);
 #endif
-        int rcWait = rc = RTSemEventWait(pThis->WriteEvent, cMillies);
+        int rcWait;
+        if (fInterruptible)
+            rcWait = rc = RTSemEventWaitNoResume(pThis->WriteEvent, cMillies);
+        else
+            rcWait = rc = RTSemEventWait(pThis->WriteEvent, cMillies);
         RTThreadUnblocked(hThreadSelf, RTTHREADSTATE_RW_WRITE);
         if (RT_UNLIKELY(RT_FAILURE_NP(rc) && rc != VERR_TIMEOUT)) /* timeouts are handled below */
@@ -651,12 +693,44 @@
     return rc;
 }
+
+
+RTDECL(int) RTSemRWRequestWrite(RTSEMRW RWSem, unsigned cMillies)
+{
+#ifndef RTSEMRW_STRICT
+    return rtSemRWRequestWrite(RWSem, cMillies, false, NULL);
+#else
+    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
+    return rtSemRWRequestWrite(RWSem, cMillies, false, &SrcPos);
+#endif
+}
 RT_EXPORT_SYMBOL(RTSemRWRequestWrite);
 
 
+RTDECL(int) RTSemRWRequestWriteDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
+{
+    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
+    return rtSemRWRequestWrite(RWSem, cMillies, false, &SrcPos);
+}
+RT_EXPORT_SYMBOL(RTSemRWRequestWriteDebug);
+
+
 RTDECL(int) RTSemRWRequestWriteNoResume(RTSEMRW RWSem, unsigned cMillies)
 {
-    return RTSemRWRequestWrite(RWSem, cMillies);
+#ifndef RTSEMRW_STRICT
+    return rtSemRWRequestWrite(RWSem, cMillies, true, NULL);
+#else
+    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
+    return rtSemRWRequestWrite(RWSem, cMillies, true, &SrcPos);
+#endif
 }
 RT_EXPORT_SYMBOL(RTSemRWRequestWriteNoResume);
+
+
+RTDECL(int) RTSemRWRequestWriteNoResumeDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
+{
+    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
+    return rtSemRWRequestWrite(RWSem, cMillies, true, &SrcPos);
+}
+RT_EXPORT_SYMBOL(RTSemRWRequestWriteNoResumeDebug);
 
 
Index: /trunk/src/VBox/Runtime/r3/posix/semrw-posix.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/posix/semrw-posix.cpp	(revision 25619)
+++ /trunk/src/VBox/Runtime/r3/posix/semrw-posix.cpp	(revision 25620)
@@ -93,4 +93,11 @@
 
 
+/* No debug wrapping here. */
+#undef RTSemRWRequestRead
+#undef RTSemRWRequestReadNoResume
+#undef RTSemRWRequestWrite
+#undef RTSemRWRequestWriteNoResume
+
+
 RTDECL(int) RTSemRWCreate(PRTSEMRW pRWSem)
 {
@@ -180,8 +187,6 @@
 
 
-RTDECL(int) RTSemRWRequestRead(RTSEMRW RWSem, unsigned cMillies)
-{
-    PRTLOCKVALSRCPOS pSrcPos = NULL;
-
+DECL_FORCE_INLINE(int) rtSemRWRequestRead(RTSEMRW RWSem, unsigned cMillies, PCRTLOCKVALSRCPOS pSrcPos)
+{
     /*
      * Validate input.
@@ -281,8 +286,38 @@
 
 
+RTDECL(int) RTSemRWRequestRead(RTSEMRW RWSem, unsigned cMillies)
+{
+#ifndef RTSEMRW_STRICT
+    return rtSemRWRequestRead(RWSem, cMillies, NULL);
+#else
+    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
+    return rtSemRWRequestRead(RWSem, cMillies, &SrcPos);
+#endif
+}
+
+
+RTDECL(int) RTSemRWRequestReadDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
+{
+    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
+    return rtSemRWRequestRead(RWSem, cMillies, &SrcPos);
+}
+
+
 RTDECL(int) RTSemRWRequestReadNoResume(RTSEMRW RWSem, unsigned cMillies)
 {
     /* EINTR isn't returned by the wait functions we're using. */
-    return RTSemRWRequestRead(RWSem, cMillies);
+#ifndef RTSEMRW_STRICT
+    return rtSemRWRequestRead(RWSem, cMillies, NULL);
+#else
+    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
+    return rtSemRWRequestRead(RWSem, cMillies, &SrcPos);
+#endif
+}
+
+
+RTDECL(int) RTSemRWRequestReadNoResumeDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
+{
+    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
+    return rtSemRWRequestRead(RWSem, cMillies, &SrcPos);
 }
 
