VirtualBox

Changeset 35077 in vbox


Ignore:
Timestamp:
Dec 14, 2010 1:37:49 PM (14 years ago)
Author:
vboxsync
Message:

VBoxService/AutoMount: Fixed shutting down flag race when actually starting the thread.

File:
1 edited

Legend:

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

    r35060 r35077  
    532532    }
    533533
     534    /*
     535     * Because this thread is a one-timer at the moment we don't want to break/change
     536     * the semantics of the main thread's start/stop sub-threads handling.
     537     *
     538     * This thread exits so fast while doing its own startup in VBoxServiceStartServices()
     539     * that this->fShutdown flag is set to true in VBoxServiceThread() before we have the
     540     * chance to check for a service failure in VBoxServiceStartServices() to indicate
     541     * a VBoxService startup error.
     542     *
     543     * Therefore *no* service threads are allowed to quit themselves and need to wait
     544     * for the pfShutdown flag to be set by the main thread.
     545     */
     546    for (;;)
     547    {
     548        /* Do we need to shutdown? */
     549        if (*pfShutdown)
     550            break;
     551
     552        /* Let's sleep for a bit and let others run ... */
     553        RTThreadSleep(500);
     554    }
     555
    534556    RTSemEventMultiDestroy(g_AutoMountEvent);
    535557    g_AutoMountEvent = NIL_RTSEMEVENTMULTI;
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