llarp::EventLoop

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
virtual TCPConnectionPool & connection_pool() =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

function running

virtual bool running() const =0

function time_now

virtual llarp_time_t time_now() const =0

function call

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

function call_soon

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

function call_later

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

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

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

function stop

virtual void stop() =0

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

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.

(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

function inEventLoop

virtual bool inEventLoop() const =0

function MaybeGetUVWLoop

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

function wakeup

virtual void wakeup() =0

function queue_work

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

function queue_slow_work

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

function num_worker_threads

virtual size_t num_worker_threads() const =0

function connection_pool

virtual TCPConnectionPool & connection_pool() =0

function create

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

Updated on 2026-04-01 at 23:35:39 +0000