Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor signal handlers #5730

Merged
merged 1 commit into from
Feb 21, 2018

Commits on Feb 21, 2018

  1. Refactor signal handlers

    Breaking change:
    - Harness the SIGCHLD handling, which is required by Process#wait.
      Now we always handle SIGCHLD using SignalChildHandler. Trying to
      reset or ignore SIGCHLD will actually set the default handler,
      trying to trap SIGCHLD will wrap the custom handler instead.
    
    Fixes:
    - Synchronize some accesses using a Mutex and an Atomic to further
      enhance potential concurrency issues —probably impossible until
      parallelism is implemented.
    - No longer closes the file descriptor at exit, which prevents an
      unhandled exception when receiving a signal while the program is
      exiting.
    - Restore STDIN/OUT/ERR blocking state on exit.
    
    Simplify implementation:
    - Move private types (SignalHandler, SignalChildHandler) to the
      private Crystal namespace.
    - Rename SignalHandler to Crystal::Signal.
    - No more singleton classes.
    - Using a Channel directly instead of a Concurrent::Future.
    - Using macros under enum (it wasn't possible before).
    - Introduce LibC::SIG_DFL and LibC::SIG_IGN definitions.
    ysbaddaden committed Feb 21, 2018
    Configuration menu
    Copy the full SHA
    0de2c81 View commit details
    Browse the repository at this point in the history