コード例 #1
0
        /* Invocations of setup and teardown are already synchronized
         * on the shutdown lock, so no further synchronization is needed here
         */

        internal static void Setup()
        {
            if (Handler != null)
            {
                return;
            }
            SignalHandler sh = new SignalHandlerAnonymousInnerClassHelper();

            Handler = sh;

            // When -Xrs is specified the user is responsible for
            // ensuring that shutdown hooks are run by calling
            // System.exit()
            try
            {
                Signal.handle(new Signal("INT"), sh);
            }
            catch (IllegalArgumentException)
            {
            }
            try
            {
                Signal.handle(new Signal("TERM"), sh);
            }
            catch (IllegalArgumentException)
            {
            }
        }
コード例 #2
0
 public virtual void Handle(Signal sig)
 {
     Shutdown.Exit(sig.Number + 0x80);
 }