VirtualBox

Changeset 31872 in vbox for trunk/src/VBox/Main/xpcom


Ignore:
Timestamp:
Aug 23, 2010 4:07:41 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
65080
Message:

xpcom: SIGUSR1 will quit the server immediately if there are no open references

File:
1 edited

Legend:

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

    r30856 r31872  
    210210static bool gAutoShutdown = false;
    211211
    212 static nsIEventQueue  *gEventQ      = nsnull;
    213 static PRBool volatile gKeepRunning = PR_TRUE;
     212static nsIEventQueue  *gEventQ          = nsnull;
     213static PRBool volatile gKeepRunning     = PR_TRUE;
     214static PRBool volatile gAllowSigUsrQuit = PR_TRUE;
    214215
    215216/////////////////////////////////////////////////////////////////////////////
     
    335336                Assert(onMainThread);
    336337            }
     338
     339            gAllowSigUsrQuit = PR_TRUE;
    337340
    338341            if (!timerStarted)
     
    533536                    /* On success, make sure the previous timer is stopped to
    534537                     * cancel a scheduled server termination (if any). */
     538                    gAllowSigUsrQuit = PR_FALSE;
    535539                    RTTimerLRStop(sTimer);
    536540                }
     
    552556
    553557                /* make sure the previous timer is stopped */
     558                gAllowSigUsrQuit = PR_FALSE;
    554559                RTTimerLRStop(sTimer);
    555560            }
     
    729734};
    730735
    731 static void signal_handler(int /* sig */)
     736static void signal_handler(int sig)
    732737{
    733738    if (gEventQ && gKeepRunning)
    734739    {
    735         /* post a quit event to the queue */
    736         ForceQuitEvent *ev = new ForceQuitEvent();
    737         ev->postTo(gEventQ);
     740        if (sig == SIGUSR1)
     741        {
     742            if (gAllowSigUsrQuit)
     743            {
     744                VirtualBoxClassFactory::MaybeQuitEvent *ev = new VirtualBoxClassFactory::MaybeQuitEvent();
     745                ev->postTo(gEventQ);
     746            }
     747            /* else do nothing */
     748        }
     749        else
     750        {
     751            /* post a force quit event to the queue */
     752            ForceQuitEvent *ev = new ForceQuitEvent();
     753            ev->postTo(gEventQ);
     754        }
    738755    }
    739756}
     
    10301047            sigaction(SIGTERM, &sa, NULL);
    10311048            sigaction(SIGTRAP, &sa, NULL);
     1049            sigaction(SIGUSR1, &sa, NULL);
    10321050        }
    10331051
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