VirtualBox

Changeset 58182 in vbox


Ignore:
Timestamp:
Oct 12, 2015 1:23:07 PM (9 years ago)
Author:
vboxsync
Message:

VBoxService: fixed semaphore destruction race.

Location:
trunk/src/VBox/Additions/common/VBoxService
Files:
4 edited

Legend:

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

    r58052 r58182  
    634634    }
    635635
    636     RTSemEventMultiDestroy(g_AutoMountEvent);
    637     g_AutoMountEvent = NIL_RTSEMEVENTMULTI;
    638 
    639636    VGSvcVerbose(3, "vbsvcAutoMountWorker: Finished with rc=%Rrc\n", rc);
    640637    return VINF_SUCCESS;
     
    666663static DECLCALLBACK(void) vbsvcAutoMountStop(void)
    667664{
    668     /*
    669      * We need this check because at the moment our auto-mount
    670      * thread really is a one-timer which destroys the event itself
    671      * after running.
    672      */
    673     if (g_AutoMountEvent != NIL_RTSEMEVENTMULTI)
    674         RTSemEventMultiSignal(g_AutoMountEvent);
     665    RTSemEventMultiSignal(g_AutoMountEvent);
    675666}
    676667
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceBalloon.cpp

    r58052 r58182  
    394394        VGSvcVerbose(3, "vgsvcBalloonInit: VbglR3CtlFilterMask failed with %Rrc\n", rc);
    395395
    396     RTSemEventMultiDestroy(g_MemBalloonEvent);
    397     g_MemBalloonEvent = NIL_RTSEMEVENTMULTI;
    398 
    399396    VGSvcVerbose(3, "vgsvcBalloonInit: finished mem balloon change request thread\n");
    400397    return VINF_SUCCESS;
     
    408405{
    409406    RTSemEventMultiSignal(g_MemBalloonEvent);
     407}
     408
     409
     410/**
     411 * @interface_method_impl{VBOXSERVICE,pfnTerm}
     412 */
     413static DECLCALLBACK(void) vgsvcBalloonTerm(void)
     414{
     415    if (g_MemBalloonEvent != NIL_RTSEMEVENTMULTI)
     416    {
     417        RTSemEventMultiDestroy(g_MemBalloonEvent);
     418        g_MemBalloonEvent = NIL_RTSEMEVENTMULTI;
     419    }
    410420}
    411421
     
    430440    vgsvcBalloonWorker,
    431441    vgsvcBalloonStop,
    432     VGSvcDefaultTerm
     442    vgsvcBalloonTerm
    433443};
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServicePageSharing.cpp

    r58089 r58182  
    761761        RTProcTerminate(hProcess);
    762762
    763     RTSemEventMultiDestroy(g_PageSharingEvent);
    764     g_PageSharingEvent = NIL_RTSEMEVENTMULTI;
    765 
    766763    VGSvcVerbose(3, "vgsvcPageSharingWorkerProcess: finished thread\n");
    767764    return 0;
     
    776773{
    777774    RTSemEventMultiSignal(g_PageSharingEvent);
     775}
     776
     777
     778/**
     779 * @interface_method_impl{VBOXSERVICE,pfnTerm}
     780 */
     781static DECLCALLBACK(void) vgsvcPageSharingTerm(void)
     782{
     783    if (g_PageSharingEvent != NIL_RTSEMEVENTMULTI)
     784    {
     785        RTSemEventMultiDestroy(g_PageSharingEvent);
     786        g_PageSharingEvent = NIL_RTSEMEVENTMULTI;
     787    }
    778788}
    779789
     
    802812#endif
    803813    vgsvcPageSharingStop,
    804     VGSvcDefaultTerm
     814    vgsvcPageSharingTerm
    805815};
    806816
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceStats.cpp

    r58034 r58182  
    685685        VGSvcVerbose(3, "vgsvcVMStatsWorker: VbglR3CtlFilterMask failed with %d\n", rc);
    686686
    687     RTSemEventMultiDestroy(g_VMStatEvent);
    688     g_VMStatEvent = NIL_RTSEMEVENTMULTI;
    689 
    690687    VGSvcVerbose(3, "VBoxStatsThread: finished statistics change request thread\n");
    691688    return 0;
     
    699696{
    700697    RTSemEventMultiSignal(g_VMStatEvent);
     698}
     699
     700
     701/**
     702 * @interface_method_impl{VBOXSERVICE,pfnTerm}
     703 */
     704static DECLCALLBACK(void) vgsvcVMStatsTerm(void)
     705{
     706    if (g_VMStatEvent != NIL_RTSEMEVENTMULTI)
     707    {
     708        RTSemEventMultiDestroy(g_VMStatEvent);
     709        g_VMStatEvent = NIL_RTSEMEVENTMULTI;
     710    }
    701711}
    702712
     
    721731    vgsvcVMStatsWorker,
    722732    vgsvcVMStatsStop,
    723     VGSvcDefaultTerm
     733    vgsvcVMStatsTerm
    724734};
    725735
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