Skip to content

Explicit initialization/capture of signals #82

@vorner

Description

@vorner

As discussed in #78, the current situation in which a library may „steal“ a signal that usually has a default handler can be undesirable. This should be something that is controlled by the application.

The proposed solution is to initialize signals explicitly. The application would call something like init_signal(SIGTERM, SigConfig::default()). That would take over the signal handler, allow libraries to hook into it and say how the library should deal with default handler (emulate it always ‒ see #81, get rid of it, call it if there are no hooks...).

We also need some backwards-compatible way to make the initialization mandatory ‒ registration would error out if that didn't happen.

However, certain libraries already take advantage of this implicit takeover (I've seen multiple async runtimes to do so for SIGCHLD). Possibly the way forward is to allow implicit initialization for signals that have an empty default signal handler (because then the takeover has no effect on the behaviour).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions