forked from dearlulu/hive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhive.h
41 lines (35 loc) · 957 Bytes
/
hive.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
** repository: https://github.com/trumanzhao/luna
** trumanzhao, 2017-05-13, trumanzhao@foxmail.com
*/
#pragma once
#include "luna.h"
const int MAJOR_VERSION_NUMBER = 0;
const int MINOR_VERSION_NUMBER = 1;
const int REVISION_NUMBER = 1;
class hive_app final {
public:
hive_app() { }
~hive_app() { }
int get_version(lua_State* L);
time_t get_file_time(const char* filename);
int get_full_path(lua_State* L);
int64_t get_time_ms();
int64_t get_time_ns();
void sleep_ms(int ms);
void daemon();
void register_signal(int n);
void default_signal(int n);
void ignore_signal(int n);
public:
void __gc() { } // custom gc, just do nothing
void set_signal(int n);
void die(const std::string& err);
void run(int argc, const char* argv[]);
DECLARE_LUA_CLASS(hive_app);
private:
uint64_t m_signal = 0;
int m_reload_time = 3000;
std::string m_entry;
};
extern hive_app* g_app;