Index: /trunk/src/VBox/Runtime/r3/posix/semmutex-posix.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/posix/semmutex-posix.cpp	(revision 43557)
+++ /trunk/src/VBox/Runtime/r3/posix/semmutex-posix.cpp	(revision 43558)
@@ -66,4 +66,37 @@
 };
 
+#ifdef RT_OS_DARWIN
+/**
+ * This function emulate pthread_mutex_timedlock on Mac OS X
+ */
+static int DarwinPthreadMutexTimedlock(pthread_mutex_t * mutex, const struct timespec * abs_timeout)
+{
+    int rc = 0;
+    struct timeval tv;
+    struct timespec rt;
+    do
+    {
+        rc = pthread_mutex_trylock(mutex);
+        if (rc == EBUSY)
+        {
+            timespec ts;
+            ts.tv_sec = 0;
+            ts.tv_sec = 10000000;
+
+            int rcSleep = -1;
+            while (rcSleep == -1)
+                rcSleep = nanosleep(&ts, &ts);
+        }
+        else
+            break;
+        gettimeofday(&tv, NULL);
+        rt.tv_sec = abs_timeout->tv_sec - tv.tv_sec;
+        rt.tv_nsec = abs_timeout->tv_nsec - tv.tv_usec * 1000;
+    } while (   rc != 0
+             || rt.tv_sec < 0);
+    return rc;
+}
+#endif
+
 
 #undef RTSemMutexCreate
@@ -242,13 +275,7 @@
     else
     {
-#ifdef RT_OS_DARWIN
-        AssertMsgFailed(("Not implemented on Darwin yet because of incomplete pthreads API."));
-        return VERR_NOT_IMPLEMENTED;
-#else /* !RT_OS_DARWIN */
-        /*
-         * Get current time and calc end of wait time.
-         */
+#if defined(RT_OS_DARWIN) || defined(RT_OS_HAIKU)
+
         struct timespec     ts = {0,0};
-#ifdef RT_OS_HAIKU
         struct timeval      tv = {0,0};
         gettimeofday(&tv, NULL);
@@ -270,5 +297,9 @@
 
         /* take mutex */
+#ifndef RT_OS_DARWIN
         int rc = pthread_mutex_timedlock(&pThis->Mutex, &ts);
+#else
+        int rc = DarwinPthreadMutexTimedlock(&pThis->Mutex, &ts);
+#endif
         RTThreadUnblocked(hThreadSelf, RTTHREADSTATE_MUTEX);
         if (rc)
@@ -277,5 +308,4 @@
             return RTErrConvertFromErrno(rc);
         }
-#endif /* !RT_OS_DARWIN */
     }
 
