VirtualBox

Ignore:
Timestamp:
Jun 15, 2016 1:16:38 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
108082
Message:

Main/xpcom/server.cpp: change the behavior of the SIGUSR1 signal handling: now it gracefully terminates an idle VBoxSVC even if it's not started with the autoterminate flag

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/xpcom/server.cpp

    r61196 r61714  
    55
    66/*
    7  * Copyright (C) 2004-2015 Oracle Corporation
     7 * Copyright (C) 2004-2016 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    211211    class MaybeQuitEvent : public NativeEvent
    212212    {
     213    public:
     214        MaybeQuitEvent() :
     215            m_fSignal(false)
     216        {
     217        }
     218
     219        MaybeQuitEvent(bool fSignal) :
     220            m_fSignal(fSignal)
     221        {
     222        }
     223
     224    private:
    213225        /* called on the main thread */
    214226        void *handler()
     
    234246            if (count == 0)
    235247            {
    236                 if (gAutoShutdown)
     248                if (gAutoShutdown || m_fSignal)
    237249                {
    238250                    Assert(sInstance == NULL);
     
    257269            return NULL;
    258270        }
     271
     272        bool m_fSignal;
    259273    };
    260274
     
    272286
    273287        /* post a quit event to the main queue */
    274         MaybeQuitEvent *ev = new MaybeQuitEvent();
     288        MaybeQuitEvent *ev = new MaybeQuitEvent(false /* fSignal */);
    275289        if (!q->postEvent(ev))
    276290            delete ev;
     
    516530            if (gAllowSigUsrQuit)
    517531            {
    518                 VirtualBoxClassFactory::MaybeQuitEvent *ev = new VirtualBoxClassFactory::MaybeQuitEvent();
     532                /* terminate the server process if it is idle */
     533                VirtualBoxClassFactory::MaybeQuitEvent *ev = new VirtualBoxClassFactory::MaybeQuitEvent(true /* fSignal */);
    519534                if (!q->postEvent(ev))
    520535                    delete ev;
Note: See TracChangeset for help on using the changeset viewer.

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