/// <summary> /// Terminates the currently running Java virtual machine by initiating its /// shutdown sequence. This method never returns normally. The argument /// serves as a status code; by convention, a nonzero status code indicates /// abnormal termination. /// /// <para> The virtual machine's shutdown sequence consists of two phases. In /// the first phase all registered <seealso cref="#addShutdownHook shutdown hooks"/>, /// if any, are started in some unspecified order and allowed to run /// concurrently until they finish. In the second phase all uninvoked /// finalizers are run if <seealso cref="#runFinalizersOnExit finalization-on-exit"/> /// has been enabled. Once this is done the virtual machine {@link #halt /// halts}. /// /// </para> /// <para> If this method is invoked after the virtual machine has begun its /// shutdown sequence then if shutdown hooks are being run this method will /// block indefinitely. If shutdown hooks have already been run and on-exit /// finalization has been enabled then this method halts the virtual machine /// with the given status code if the status is nonzero; otherwise, it /// blocks indefinitely. /// /// </para> /// <para> The <tt><seealso cref="System#exit(int) System.exit"/></tt> method is the /// </para> /// conventional and convenient means of invoking this method. <para> /// /// </para> /// </summary> /// <param name="status"> /// Termination status. By convention, a nonzero status code /// indicates abnormal termination. /// </param> /// <exception cref="SecurityException"> /// If a security manager is present and its <tt>{@link /// SecurityManager#checkExit checkExit}</tt> method does not permit /// exiting with the specified status /// </exception> /// <seealso cref= java.lang.SecurityException </seealso> /// <seealso cref= java.lang.SecurityManager#checkExit(int) </seealso> /// <seealso cref= #addShutdownHook </seealso> /// <seealso cref= #removeShutdownHook </seealso> /// <seealso cref= #runFinalizersOnExit </seealso> /// <seealso cref= #halt(int) </seealso> public virtual void Exit(int status) { SecurityManager security = System.SecurityManager; if (security != null) { security.CheckExit(status); } Shutdown.Exit(status); }
public virtual void Handle(Signal sig) { Shutdown.Exit(sig.Number + 0x80); }