/* 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) { } }
public virtual void Handle(Signal sig) { Shutdown.Exit(sig.Number + 0x80); }