Class SignalHandle

Synopsis

#include <src/uvw/signal.h>

class SignalHandle final: public Handle<SignalHandle, uv_signal_t>

Description

The SignalHandle handle.

Signal handles implement Unix style signal handling on a per-event loop bases.
Reception of some signals is emulated on Windows.

To create a SignalHandle through a Loop, no arguments are required.

See the official documentation for further details.

Inheritance

Ancestors: Handle

Methods

initInitializes the handle.
oneShotStarts the handle.
signalGets the signal being monitored.
startStarts the handle.
stopStops the handle.

Source

Lines 38-79 in src/uvw/signal.h.

class SignalHandle final: public Handle<SignalHandle, uv_signal_t> {
    static void startCallback(uv_signal_t *handle, int signum);

public:
    using Handle::Handle;

    /**
     * @brief Initializes the handle.
     * @return True in case of success, false otherwise.
     */
    bool init();

    /**
     * @brief Starts the handle.
     *
     * The handle will start emitting SignalEvent when needed.
     *
     * @param signum The signal to be monitored.
     */
    void start(int signum);

    /**
     * @brief Starts the handle.
     *
     * Same functionality as SignalHandle::start but the signal handler is reset
     * the moment the signal is received.
     *
     * @param signum
     */
    void oneShot(int signum);

    /**
     * @brief Stops the handle.
     */
    void stop();

    /**
     * @brief Gets the signal being monitored.
     * @return The signal being monitored.
     */
    int signal() const noexcept;
};





Add Discussion as Guest

Log in