llarp::uv::Loop

Inherits from llarp::EventLoop

Public Types

Name
using std::function< void()> Callback

Public Functions

Name
Loop(size_t queue_size, size_t worker_num_threads)
~Loop() override
virtual void run() override
virtual bool running() const override
virtual llarp_time_t time_now() const override
virtual void call_later(llarp_time_t delay_ms, std::function< void(void)> callback) override
void tick_event_loop()
virtual void stop() override
virtual bool add_ticker(std::function< void(void)> ticker) override
bool add_network_interface(std::shared_ptr< llarp::vpn::NetworkInterface > netif, std::function< void(llarp::net::IPPacket)> handler) override
virtual void call_soon(std::function< void(void)> f) override
virtual std::shared_ptr< llarp::EventLoopWakeup > make_waker(std::function< void()> callback) override
Make a thread-safe event loop waker (an "async" in libuv terminology) on this event loop; you can call ->Trigger() on the returned shared pointer to fire the callback at the next available event loop iteration.
virtual std::shared_ptr< EventLoopRepeater > make_repeater() override
virtual std::shared_ptr< llarp::UDPHandle > make_udp(UDPReceiveFunc on_recv) override
std::shared_ptr< EventLoopPoller > add_poller(int fd, std::function< void()> callback) override
void FlushLogic()
virtual std::shared_ptr< uvw::Loop > MaybeGetUVWLoop() override
virtual bool inEventLoop() const override
virtual void queue_work(std::unique_ptr< EventLoopWork > work) override
virtual void queue_slow_work(std::unique_ptr< EventLoopWork > work) override
virtual size_t num_worker_threads() const override

Protected Attributes

Name
std::shared_ptr< uvw::Loop > m_Impl
std::optional< std::thread::id > m_EventLoopThreadID

Additional inherited members

Public Types inherited from llarp::EventLoop

Name
using std::function< void(UDPHandle &, SockAddr src, llarp::OwnedBuffer buf)> UDPReceiveFunc

Public Functions inherited from llarp::EventLoop

Name
template <typename Callable >
void
call(Callable && f)
template <typename Callable >
void
call_every(llarp_time_t repeat, std::weak_ptr< void > owner, Callable f)
template <typename Callable >
auto
make_caller(Callable f)
virtual ~EventLoop() =default
virtual const net::Platform * Net_ptr() const
std::shared_ptr< EventLoop > create(size_t num_threads, size_t queueLength =event_loop_queue_size)

Public Types Documentation

using Callback

using llarp::uv::Loop::Callback =  std::function<void()>;

Public Functions Documentation

function Loop

Loop(
    size_t queue_size,
    size_t worker_num_threads
)

function ~Loop

~Loop() override

function run

virtual void run() override

Reimplements: llarp::EventLoop::run

function running

virtual bool running() const override

Reimplements: llarp::EventLoop::running

function time_now

inline virtual llarp_time_t time_now() const override

Reimplements: llarp::EventLoop::time_now

function call_later

virtual void call_later(
    llarp_time_t delay_ms,
    std::function< void(void)> callback
) override

Reimplements: llarp::EventLoop::call_later

function tick_event_loop

void tick_event_loop()

function stop

virtual void stop() override

Reimplements: llarp::EventLoop::stop

function add_ticker

virtual bool add_ticker(
    std::function< void(void)> ticker
) override

Reimplements: llarp::EventLoop::add_ticker

function add_network_interface

bool add_network_interface(
    std::shared_ptr< llarp::vpn::NetworkInterface > netif,
    std::function< void(llarp::net::IPPacket)> handler
) override

function call_soon

virtual void call_soon(
    std::function< void(void)> f
) override

Reimplements: llarp::EventLoop::call_soon

function make_waker

virtual std::shared_ptr< llarp::EventLoopWakeup > make_waker(
    std::function< void()> callback
) override

Make a thread-safe event loop waker (an "async" in libuv terminology) on this event loop; you can call ->Trigger() on the returned shared pointer to fire the callback at the next available event loop iteration.

Reimplements: llarp::EventLoop::make_waker

(Multiple Trigger calls invoked before the call is actually made are coalesced into one call).

function make_repeater

virtual std::shared_ptr< EventLoopRepeater > make_repeater() override

Reimplements: llarp::EventLoop::make_repeater

function make_udp

virtual std::shared_ptr< llarp::UDPHandle > make_udp(
    UDPReceiveFunc on_recv
) override

Reimplements: llarp::EventLoop::make_udp

function add_poller

std::shared_ptr< EventLoopPoller > add_poller(
    int fd,
    std::function< void()> callback
) override

function FlushLogic

void FlushLogic()

function MaybeGetUVWLoop

virtual std::shared_ptr< uvw::Loop > MaybeGetUVWLoop() override

Reimplements: llarp::EventLoop::MaybeGetUVWLoop

function inEventLoop

virtual bool inEventLoop() const override

Reimplements: llarp::EventLoop::inEventLoop

function queue_work

virtual void queue_work(
    std::unique_ptr< EventLoopWork > work
) override

Reimplements: llarp::EventLoop::queue_work

function queue_slow_work

virtual void queue_slow_work(
    std::unique_ptr< EventLoopWork > work
) override

Reimplements: llarp::EventLoop::queue_slow_work

function num_worker_threads

virtual size_t num_worker_threads() const override

Reimplements: llarp::EventLoop::num_worker_threads

Protected Attributes Documentation

variable m_Impl

std::shared_ptr< uvw::Loop > m_Impl;

variable m_EventLoopThreadID

std::optional< std::thread::id > m_EventLoopThreadID;

Updated on 2026-01-10 at 22:49:45 +0000