lokinet/include/llarp/logic.h

53 lines
1.1 KiB
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
2018-10-29 16:48:36 +00:00
llarp_logic_tick(struct llarp_logic* logic, llarp_time_t now);
2018-06-06 12:46:26 +00:00
2018-08-09 19:02:17 +00:00
/// isolated tick
void
2018-10-29 16:48:36 +00:00
llarp_logic_tick_async(struct llarp_logic* logic, llarp_time_t now);
2018-08-09 19:02:17 +00:00
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);
2018-08-09 19:02:17 +00:00
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