Class Signals

java.lang.Object
org.aesh.terminal.tty.utils.Signals

public final class Signals extends Object
Signals helpers.
Author:
Guillaume Nodet
  • Method Details

    • register

      public static Object register(String name, Runnable handler)
      Registers a signal handler for the specified signal.
      Parameters:
      name - the signal, CONT, STOP, etc...
      handler - the callback to run
      Returns:
      an object that needs to be passed to the unregister(String, Object) method to unregister the handler
    • register

      public static Object register(String name, Runnable handler, ClassLoader loader)
      Registers a signal handler using the specified class loader.
      Parameters:
      name - the signal name (e.g., CONT, STOP)
      handler - the callback to run when the signal is received
      loader - the class loader to use for creating the signal handler proxy
      Returns:
      an object that needs to be passed to unregister(String, Object) to unregister the handler, or null if registration failed
    • registerDefault

      public static Object registerDefault(String name)
      Registers the default signal handler for the specified signal.
      Parameters:
      name - the signal name (e.g., CONT, STOP)
      Returns:
      an object that needs to be passed to unregister(String, Object) to unregister the handler, or null if registration failed
    • registerIgnore

      public static Object registerIgnore(String name)
      Registers an ignore handler for the specified signal, causing the signal to be ignored.
      Parameters:
      name - the signal name (e.g., CONT, STOP)
      Returns:
      an object that needs to be passed to unregister(String, Object) to unregister the handler, or null if registration failed
    • invokeHandler

      public static void invokeHandler(String name, Object handler)
      Invokes a signal handler directly for the specified signal.
      Parameters:
      name - the signal name (e.g., CONT, STOP)
      handler - the signal handler to invoke
    • unregister

      public static void unregister(String name, Object previous)
      Unregisters a signal handler by restoring the previous handler.
      Parameters:
      name - the signal name (e.g., CONT, STOP)
      previous - the previous handler returned by a register method