Class AsyncHandle

Synopsis

#include <src/uvw/async.h>

class AsyncHandle final: public Handle<AsyncHandle, uv_async_t>

Description

The AsyncHandle handle.

Async handles allow the user to wakeup the event loop and get an event emitted from another thread.

To create an AsyncHandle through a Loop, no arguments are required.

Inheritance

Ancestors: Handle

Methods

initInitializes the handle.
sendWakeups the event loop and emits the AsyncEvent event.

Source

Lines 29-56 in src/uvw/async.h.

class AsyncHandle final: public Handle<AsyncHandle, uv_async_t> {
    static void sendCallback(uv_async_t *handle);

public:
    using Handle::Handle;

    /**
     * @brief Initializes the handle.
     *
     * Unlike other handle initialization functions, it immediately starts the
     * handle.
     *
     * @return True in case of success, false otherwise.
     */
    bool init();

    /**
     * @brief Wakeups the event loop and emits the AsyncEvent event.
     *
     * It’s safe to call this function from any thread.<br/>
     * An AsyncEvent event will be emitted on the loop thread.
     *
     * See the official
     * [documentation](http://docs.libuv.org/en/v1.x/async.html#c.uv_async_send)
     * for further details.
     */
    void send();
};





Add Discussion as Guest

Log in