---
title: llarp::uv::Loop

---

# llarp::uv::Loop





Inherits from [llarp::EventLoop](Classes/classllarp_1_1EventLoop.md)

## Public Types

|                | Name           |
| -------------- | -------------- |
| using std::function< void()> | **[Callback](Classes/classllarp_1_1uv_1_1Loop.md#using-callback)**  |

## Public Functions

|                | Name           |
| -------------- | -------------- |
| | **[Loop](Classes/classllarp_1_1uv_1_1Loop.md#function-loop)**(size_t queue_size) |
| virtual void | **[run](Classes/classllarp_1_1uv_1_1Loop.md#function-run)**() override |
| virtual bool | **[running](Classes/classllarp_1_1uv_1_1Loop.md#function-running)**() const override |
| virtual llarp_time_t | **[time_now](Classes/classllarp_1_1uv_1_1Loop.md#function-time-now)**() const override |
| virtual void | **[call_later](Classes/classllarp_1_1uv_1_1Loop.md#function-call-later)**(llarp_time_t delay_ms, std::function< void(void)> callback) override |
| void | **[tick_event_loop](Classes/classllarp_1_1uv_1_1Loop.md#function-tick-event-loop)**() |
| virtual void | **[stop](Classes/classllarp_1_1uv_1_1Loop.md#function-stop)**() override |
| virtual bool | **[add_ticker](Classes/classllarp_1_1uv_1_1Loop.md#function-add-ticker)**(std::function< void(void)> ticker) override |
| bool | **[add_network_interface](Classes/classllarp_1_1uv_1_1Loop.md#function-add-network-interface)**(std::shared_ptr< [llarp::vpn::NetworkInterface](Classes/classllarp_1_1vpn_1_1NetworkInterface.md) > netif, std::function< void([llarp::net::IPPacket](Classes/structllarp_1_1net_1_1IPPacket.md))> handler) override |
| virtual void | **[call_soon](Classes/classllarp_1_1uv_1_1Loop.md#function-call-soon)**(std::function< void(void)> f) override |
| virtual std::shared_ptr< [llarp::EventLoopWakeup](Classes/classllarp_1_1EventLoopWakeup.md) > | **[make_waker](Classes/classllarp_1_1uv_1_1Loop.md#function-make-waker)**(std::function< void()> callback) override<br>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](Classes/classllarp_1_1EventLoopRepeater.md) > | **[make_repeater](Classes/classllarp_1_1uv_1_1Loop.md#function-make-repeater)**() override |
| virtual std::shared_ptr< [llarp::UDPHandle](Classes/structllarp_1_1UDPHandle.md) > | **[make_udp](Classes/classllarp_1_1uv_1_1Loop.md#function-make-udp)**(UDPReceiveFunc on_recv) override |
| void | **[FlushLogic](Classes/classllarp_1_1uv_1_1Loop.md#function-flushlogic)**() |
| virtual std::shared_ptr< uvw::Loop > | **[MaybeGetUVWLoop](Classes/classllarp_1_1uv_1_1Loop.md#function-maybegetuvwloop)**() override |
| virtual bool | **[inEventLoop](Classes/classllarp_1_1uv_1_1Loop.md#function-ineventloop)**() const override |

## Protected Attributes

|                | Name           |
| -------------- | -------------- |
| std::shared_ptr< uvw::Loop > | **[m_Impl](Classes/classllarp_1_1uv_1_1Loop.md#variable-m-impl)**  |
| std::optional< std::thread::id > | **[m_EventLoopThreadID](Classes/classllarp_1_1uv_1_1Loop.md#variable-m-eventloopthreadid)**  |

## Additional inherited members

**Public Types inherited from [llarp::EventLoop](Classes/classllarp_1_1EventLoop.md)**

|                | Name           |
| -------------- | -------------- |
| using std::function< void([UDPHandle](Classes/structllarp_1_1UDPHandle.md) &, [SockAddr](Classes/structllarp_1_1SockAddr.md) src, [llarp::OwnedBuffer](Classes/structllarp_1_1OwnedBuffer.md) buf)> | **[UDPReceiveFunc](Classes/classllarp_1_1EventLoop.md#using-udpreceivefunc)**  |

**Public Functions inherited from [llarp::EventLoop](Classes/classllarp_1_1EventLoop.md)**

|                | Name           |
| -------------- | -------------- |
| template <typename Callable \> <br>void | **[call](Classes/classllarp_1_1EventLoop.md#function-call)**(Callable && f) |
| template <typename Callable \> <br>void | **[call_every](Classes/classllarp_1_1EventLoop.md#function-call-every)**(llarp_time_t repeat, std::weak_ptr< void > owner, Callable f) |
| template <typename Callable \> <br>auto | **[make_caller](Classes/classllarp_1_1EventLoop.md#function-make-caller)**(Callable f) |
| virtual | **[~EventLoop](Classes/classllarp_1_1EventLoop.md#function-~eventloop)**() =default |
| virtual const [net::Platform](Classes/classllarp_1_1net_1_1Platform.md) * | **[Net_ptr](Classes/classllarp_1_1EventLoop.md#function-net-ptr)**() const |
| std::shared_ptr< [EventLoop](Classes/classllarp_1_1EventLoop.md) > | **[create](Classes/classllarp_1_1EventLoop.md#function-create)**(size_t queueLength =[event_loop_queue_size](Namespaces/namespacellarp.md#variable-event-loop-queue-size)) |


## Public Types Documentation

### using Callback

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


## Public Functions Documentation

### function Loop

```cpp
Loop(
    size_t queue_size
)
```


### function run

```cpp
virtual void run() override
```


**Reimplements**: [llarp::EventLoop::run](Classes/classllarp_1_1EventLoop.md#function-run)


### function running

```cpp
virtual bool running() const override
```


**Reimplements**: [llarp::EventLoop::running](Classes/classllarp_1_1EventLoop.md#function-running)


### function time_now

```cpp
inline virtual llarp_time_t time_now() const override
```


**Reimplements**: [llarp::EventLoop::time_now](Classes/classllarp_1_1EventLoop.md#function-time-now)


### function call_later

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


**Reimplements**: [llarp::EventLoop::call_later](Classes/classllarp_1_1EventLoop.md#function-call-later)


### function tick_event_loop

```cpp
void tick_event_loop()
```


### function stop

```cpp
virtual void stop() override
```


**Reimplements**: [llarp::EventLoop::stop](Classes/classllarp_1_1EventLoop.md#function-stop)


### function add_ticker

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


**Reimplements**: [llarp::EventLoop::add_ticker](Classes/classllarp_1_1EventLoop.md#function-add-ticker)


### function add_network_interface

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


### function call_soon

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


**Reimplements**: [llarp::EventLoop::call_soon](Classes/classllarp_1_1EventLoop.md#function-call-soon)


### function make_waker

```cpp
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](Classes/classllarp_1_1EventLoop.md#function-make-waker)


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


### function make_repeater

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


**Reimplements**: [llarp::EventLoop::make_repeater](Classes/classllarp_1_1EventLoop.md#function-make-repeater)


### function make_udp

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


**Reimplements**: [llarp::EventLoop::make_udp](Classes/classllarp_1_1EventLoop.md#function-make-udp)


### function FlushLogic

```cpp
void FlushLogic()
```


### function MaybeGetUVWLoop

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


**Reimplements**: [llarp::EventLoop::MaybeGetUVWLoop](Classes/classllarp_1_1EventLoop.md#function-maybegetuvwloop)


### function inEventLoop

```cpp
virtual bool inEventLoop() const override
```


**Reimplements**: [llarp::EventLoop::inEventLoop](Classes/classllarp_1_1EventLoop.md#function-ineventloop)


## Protected Attributes Documentation

### variable m_Impl

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


### variable m_EventLoopThreadID

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


-------------------------------

Updated on 2025-01-26 at 05:10:09 +0000