mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
loop->call(...) is similar to the old logic->Call(...), but is smart about the current thread: if called from within the event loop it simply runs the argument directly, otherwise it queues it. Similarly most of the other event loop calls are also now thread-aware: for example, `call_later(...)` can queue the job directly when called if in the event loop rather than having to double-queue through the even loop (once to call, then inside the call to initiate the time).
20 lines
339 B
C++
20 lines
339 B
C++
#include <ev/ev.hpp>
|
|
#include <util/mem.hpp>
|
|
#include <util/str.hpp>
|
|
|
|
#include <cstddef>
|
|
#include <cstring>
|
|
#include <string_view>
|
|
|
|
// We libuv now
|
|
#include <ev/ev_libuv.hpp>
|
|
|
|
namespace llarp
|
|
{
|
|
EventLoop_ptr
|
|
EventLoop::create(size_t queueLength)
|
|
{
|
|
return std::make_shared<llarp::uv::Loop>(queueLength);
|
|
}
|
|
} // namespace llarp
|