Skip to content

Support shutdown / cleanup of SIGCHLD handler #34

@ukautz

Description

@ukautz

Hi. First: Very neat crate! Makes my code much better readable than while-looping and waiting.

I ran into an issue relating to the SIGCHLD handler that is installed, but not removed. TL;DR: any code that uses syscalls and that does not explicitly handle std::io::ErrorKind::Interrupted is liable to blow up in your face (for a POC see here).

I understand that this crate works with global state and aims to install the handler only once, reusing it afterwards to support async execution. That makes of course sense, however an interface to restore the default signal handler at least manually would be great. This would also surface that it is required to do so, in case you plan on executing any syscalls yourself.

Currently the documentation mentions:

[..] The current implementation registers a SIGCHLD handler and initializes some global state. This handler also works within multi-threaded environments. If your application is otherwise handling SIGCHLD then bugs may arise.

Alternative to adding the "uninstall interface" make it really clear that you must handle interruptions yourself (alas that was not clear to me).

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