llarp::EventLoop

Inherited by llarp::io_uring::Loop, llarp::uv::Loop

Public Types

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

Public Functions

Name
virtual void run() =0
virtual bool running() const =0
virtual llarp_time_t time_now() const =0
template <typename Callable >
void
call(Callable && f)
virtual void call_soon(std::function< void(void)> f) =0
virtual void call_later(llarp_time_t delay_ms, std::function< void(void)> callback) =0
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 std::shared_ptr< EventLoopPoller > add_poller(int fd, std::function< void(void)> callback) =0
add a new event loop poller
virtual bool add_network_interface(std::shared_ptr< vpn::NetworkInterface > netif, std::function< void(net::IPPacket)> packetHandler) =0
virtual bool add_ticker(std::function< void(void)> ticker) =0
virtual void stop() =0
virtual ~EventLoop() =default
virtual const net::Platform * Net_ptr() const
virtual std::shared_ptr< UDPHandle > make_udp(UDPReceiveFunc on_recv) =0
virtual std::shared_ptr< EventLoopWakeup > make_waker(std::function< void()> callback) =0
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() =0
virtual bool inEventLoop() const =0
virtual std::shared_ptr< uvw::Loop > MaybeGetUVWLoop()
virtual void wakeup() =0
virtual void queue_work(std::unique_ptr< EventLoopWork > work) =0
virtual void queue_slow_work(std::unique_ptr< EventLoopWork > work) =0
virtual size_t num_worker_threads() const =0
std::shared_ptr< EventLoop > create(size_t num_threads, size_t queueLength =event_loop_queue_size)

Public Types Documentation

using UDPReceiveFunc

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

Public Functions Documentation

function run

virtual void run() =0

Reimplemented by: llarp::io_uring::Loop::run, llarp::uv::Loop::run

function running

virtual bool running() const =0

Reimplemented by: llarp::io_uring::Loop::running, llarp::uv::Loop::running

function time_now

virtual llarp_time_t time_now() const =0

Reimplemented by: llarp::io_uring::Loop::time_now, llarp::uv::Loop::time_now

function call

template <typename Callable >
inline void call(
    Callable && f
)

function call_soon

virtual void call_soon(
    std::function< void(void)> f
) =0

Reimplemented by: llarp::io_uring::Loop::call_soon, llarp::uv::Loop::call_soon

function call_later

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

Reimplemented by: llarp::io_uring::Loop::call_later, llarp::uv::Loop::call_later

function call_every

template <typename Callable >
inline void call_every(
    llarp_time_t repeat,
    std::weak_ptr< void > owner,
    Callable f
)

function make_caller

template <typename Callable >
inline auto make_caller(
    Callable f
)

function add_poller

virtual std::shared_ptr< EventLoopPoller > add_poller(
    int fd,
    std::function< void(void)> callback
) =0

add a new event loop poller

Reimplemented by: llarp::io_uring::Loop::add_poller

function add_network_interface

virtual bool add_network_interface(
    std::shared_ptr< vpn::NetworkInterface > netif,
    std::function< void(net::IPPacket)> packetHandler
) =0

function add_ticker

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

Reimplemented by: llarp::io_uring::Loop::add_ticker, llarp::uv::Loop::add_ticker

function stop

virtual void stop() =0

Reimplemented by: llarp::io_uring::Loop::stop, llarp::uv::Loop::stop

function ~EventLoop

virtual ~EventLoop() =default

function Net_ptr

virtual const net::Platform * Net_ptr() const

function make_udp

virtual std::shared_ptr< UDPHandle > make_udp(
    UDPReceiveFunc on_recv
) =0

Reimplemented by: llarp::io_uring::Loop::make_udp, llarp::uv::Loop::make_udp

function make_waker

virtual std::shared_ptr< EventLoopWakeup > make_waker(
    std::function< void()> callback
) =0

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.

Reimplemented by: llarp::io_uring::Loop::make_waker, llarp::uv::Loop::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() =0

Reimplemented by: llarp::io_uring::Loop::make_repeater, llarp::uv::Loop::make_repeater

function inEventLoop

virtual bool inEventLoop() const =0

Reimplemented by: llarp::io_uring::Loop::inEventLoop, llarp::uv::Loop::inEventLoop

function MaybeGetUVWLoop

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

Reimplemented by: llarp::io_uring::Loop::MaybeGetUVWLoop, llarp::uv::Loop::MaybeGetUVWLoop

function wakeup

virtual void wakeup() =0

Reimplemented by: llarp::io_uring::Loop::wakeup, llarp::uv::Loop::wakeup

function queue_work

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

Reimplemented by: llarp::io_uring::Loop::queue_work, llarp::uv::Loop::queue_work

function queue_slow_work

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

Reimplemented by: llarp::io_uring::Loop::queue_slow_work, llarp::uv::Loop::queue_slow_work

function num_worker_threads

virtual size_t num_worker_threads() const =0

Reimplemented by: llarp::io_uring::Loop::num_worker_threads, llarp::uv::Loop::num_worker_threads

function create

static std::shared_ptr< EventLoop > create(
    size_t num_threads,
    size_t queueLength =event_loop_queue_size
)

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