[][src]Function signal_hook::pipe::register_raw

pub fn register_raw(signal: c_int, pipe: RawFd) -> Result<SigId, Error>

Registers a write to a self-pipe whenever there's the signal.

In this case, the pipe is taken as the RawFd. It'll be closed on deregistration. Effectively, the function takes ownership of the file descriptor. This includes feeling free to set arbitrary flags on it, including file status flags (that are shared across file descriptors created by dup).

Note that passing the wrong file descriptor won't cause UB, but can still lead to severe bugs ‒ like data corruptions in files. Prefer using register if possible.

Also, it is perfectly legal for multiple writes to be collated together (if not consumed) and to generate spurious wakeups (but will not generate spurious bytes in the pipe).

Internal details

Internally, it currently does following. Note that this is not part of the stability guarantees and may change if necessary.