VirtualBox

Changeset 39428 in vbox


Ignore:
Timestamp:
Nov 25, 2011 4:18:40 PM (13 years ago)
Author:
vboxsync
Message:

review change.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp

    r39427 r39428  
    5555*   Internal Functions                                                         *
    5656*******************************************************************************/
    57 /** @todo Shorten "VBoxServiceControl" to "vbgsvcCntl". */
     57/** @todo Shorten "VBoxServiceControl" to "gstsvcCntl". */
    5858static int VBoxServiceControlStartAllowed(bool *pbAllowed);
    5959static int VBoxServiceControlHandleCmdStartProc(uint32_t u32ClientId, uint32_t uNumParms);
     
    814814         * not used anymore. */
    815815        PVBOXSERVICECTRLTHREAD pThreadCur;
    816         RTListForEach(&g_GuestControlThreads, pThreadCur, VBOXSERVICECTRLTHREAD, Node)
    817         {
    818             if (   pThreadCur->uPID == uPID
    819                 && pThreadCur       != pThread)
     816        bool fTryAgain = false;
     817        do
     818        {
     819            RTListForEach(&g_GuestControlThreads, pThreadCur, VBOXSERVICECTRLTHREAD, Node)
    820820            {
    821                 VBoxServiceVerbose(2, "ControlThread: PID %u was used before, shutting down stale exec thread ...\n",
    822                                    uPID);
    823                 rc = VBoxServiceControlThreadSignalShutdown(pThreadCur);
    824                 if (RT_SUCCESS(rc))
    825                     rc = VBoxServiceControlThreadWaitForShutdown(pThreadCur,
    826                                                                  30 * 1000 /* Wait 30 seconds max. */);
     821                if (pThreadCur->uPID == uPID)
     822                {
     823                    Assert(pThreadCur != pThread); /* can't happen */
     824                    uint32_t uTriedPID = uPID;
     825                    uPID += 391939;
     826                    VBoxServiceVerbose(2, "ControlThread: PID %u was used before, trying again with %u ...\n",
     827                                       uTriedPID, uPID);
     828                    fTryAgain = true;
     829                    break;
     830                }
    827831            }
    828         }
     832        } while (fTryAgain);
    829833
    830834        /* Assign PID to current thread. */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette