Index: /trunk/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c
===================================================================
--- /trunk/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c	(revision 30932)
+++ /trunk/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c	(revision 30933)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -183,12 +183,11 @@
     }
 
+    /*
+     * If there are more waiting threads, wake them up. Otherwise leave the
+     * semaphore in the signalled state.
+     */
     pThis->cWakeUp++;
-    if (pThis->cWakeUp <= pThis->cWaiters)
-    {
-        /*
-         * We decrement waiters here so that we don't keep signalling threads that
-         * have already been signalled but not yet scheduled. So cWaiters might be
-         * 0 even when there are threads actually waiting.
-         */
+    if (pThis->cWakeUp <= pThis->cWaiters) /** @todo r=bird: see cWakeup = 0 below. */
+    {
         cv_signal(&pThis->Cnd);
         pThis->uSignalGen++;
@@ -256,5 +255,10 @@
         Assert(!pThis->cWaiters);
         pThis->fSignaled = false;
-        pThis->cWakeUp = 0;
+        /** @todo r=bird: This will get out of whack if someone is in the
+         *        process of waking up (waiting to be scheduled). Further
+         *        more, a race between a cv_signal and a
+         *        timeout/interruption may cause wakeups to go unconsumed.
+         *        Not sure how we could easily deal with this rigth now... */
+        pThis->cWakeUp   = 0;
         rc = VINF_SUCCESS;
     }
@@ -276,5 +280,5 @@
                     {
                         /* We've been signaled by cv_signal(), consume the wake up. */
-                        --pThis->cWakeUp;
+                        --pThis->cWakeUp; /** @todo r=bird: May cause underflow, see above. */
                         rc = VINF_SUCCESS;
                     }
@@ -294,7 +298,7 @@
                 rc = VERR_INTERRUPTED;
 
-            --pThis->cWaiters;
             break;
         }
+        --pThis->cWaiters;
     }
 
