Index: /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp	(revision 30435)
+++ /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp	(revision 30436)
@@ -796,9 +796,4 @@
     AssertPtr(pData);
 
-    /*
-     * Tell the control thread that it can continue
-     * spawning services.
-     */
-    RTThreadUserSignal(RTThreadSelf());
     VBoxServiceVerbose(3, "ControlExec: Thread of process \"%s\" started\n", pData->pszCmd);
 
@@ -807,6 +802,9 @@
     {
         VBoxServiceError("ControlExec: Thread failed to connect to the guest control service, aborted! Error: %Rrc\n", rc);
+        RTThreadUserSignal(RTThreadSelf());
         return rc;
     }
+
+    bool fSignalled = false; /* Indicator whether we signalled the thread user event already. */
 
     /*
@@ -868,4 +866,16 @@
                                                                          pData->pszUser, pData->pszPassword,
                                                                          &hProcess);
+
+                                /*
+                                 * Tell the control thread that it can continue
+                                 * spawning services. This needs to be done after the new
+                                 * process has been started because otherwise signal handling 
+                                 * on (Open) Solaris does not work correctly (see #5068).
+                                 */
+                                int rc2 = RTThreadUserSignal(RTThreadSelf());
+                                if (RT_FAILURE(rc2))
+                                    rc = rc2;
+                                fSignalled = true;
+
                                 if (RT_SUCCESS(rc))
                                 {
@@ -928,4 +938,11 @@
     VBoxServiceVerbose(3, "ControlExec: Thread of process \"%s\" (PID: %u) ended with rc=%Rrc\n",
                        pData->pszCmd, pData->uPID, rc);
+
+    /* 
+     * If something went wrong signal the user event so that others don't wait
+     * forever on this thread. 
+     */
+    if (RT_FAILURE(rc) && !fSignalled)
+        RTThreadUserSignal(RTThreadSelf());
     return rc;
 }
@@ -967,4 +984,6 @@
             else
             {
+                VBoxServiceVerbose(4, "ControlExec: Waiting for thread to initialize ...\n");
+
                 /* Wait for the thread to initialize. */
                 RTThreadUserWait(pThread->Thread, 60 * 1000);
