Function run


#include <src/uvw/loop.h>

template <Mode mode = Mode::DEFAULT>
bool run() noexcept


Runs the event loop.

Available modes are:

  • Loop::Mode::DEFAULT: Runs the event loop until there are no more active and referenced handles or requests.
  • Loop::Mode::ONCE: Poll for i/o once. Note that this function blocks if there are no pending callbacks.
  • Loop::Mode::NOWAIT: Poll for i/o once but don’t block if there are no pending callbacks.

See the official documentation for further details.

True when done, false in all other cases.


Lines 71-76 in src/uvw/loop.cpp. Line 199 in src/uvw/loop.h.

template<Loop::Mode mode>
bool Loop::run() noexcept {
    auto utm = static_cast<std::underlying_type_t<Mode>>(mode);
    auto uvrm = static_cast<uv_run_mode>(utm);
    return (uv_run(loop.get(), uvrm) == 0);

Add Discussion as Guest

Log in