lokinet/include/llarp/logic.h

48 lines
1001 B
C
Raw Normal View History

2018-04-30 18:18:18 +00:00
#ifndef LLARP_LOGIC_H
#define LLARP_LOGIC_H
2018-05-20 16:15:16 +00:00
#include <llarp/mem.h>
2018-04-30 18:18:18 +00:00
#include <llarp/threadpool.h>
#include <llarp/timer.h>
2018-07-09 04:26:27 +00:00
struct llarp_logic
{
struct llarp_threadpool* thread;
struct llarp_timer_context* timer;
};
2018-04-30 18:18:18 +00:00
struct llarp_logic*
llarp_init_logic();
2018-04-30 18:18:18 +00:00
2018-06-06 12:46:26 +00:00
/// single threaded mode logic event loop
struct llarp_logic*
llarp_init_single_process_logic(struct llarp_threadpool* tp);
/// single threaded tick
void
llarp_logic_tick(struct llarp_logic* logic);
void
llarp_free_logic(struct llarp_logic** logic);
2018-04-30 18:18:18 +00:00
void
llarp_logic_queue_job(struct llarp_logic* logic, struct llarp_thread_job job);
2018-04-30 18:18:18 +00:00
uint32_t
llarp_logic_call_later(struct llarp_logic* logic, struct llarp_timeout_job job);
void
llarp_logic_cancel_call(struct llarp_logic* logic, uint32_t id);
2018-04-30 18:18:18 +00:00
void
llarp_logic_remove_call(struct llarp_logic* logic, uint32_t id);
void
llarp_logic_stop_timer(struct llarp_logic* logic);
void
llarp_logic_stop(struct llarp_logic* logic);
2018-04-30 18:18:34 +00:00
void
llarp_logic_mainloop(struct llarp_logic* logic);
2018-04-30 18:18:18 +00:00
#endif