-
Notifications
You must be signed in to change notification settings - Fork 16
/
App.h
executable file
·76 lines (59 loc) · 1.31 KB
/
App.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef TX_APP_H
#define TX_APP_H
#include "FS/FS.h"
#if defined(_WIN32)
#include <synchapi.h>
#else
#include <unistd.h>
#endif
class App {
private:
bool terminateSignal = false;
bool reindexing = false;
bool starting = false;
uint32_t reindexingHeight = 0;
public:
static App& Instance(){
static App instance;
return instance;
}
//@TODO use!
void terminate() {
terminateSignal = true;
#if defined(_WIN32)
Sleep(3000);
#else
sleep(3);
#endif
immediateTerminate();
}
void immediateTerminate() {
terminateSignal = true;
if(FS::fileExists(FS::getLockPath())) {
FS::deleteFile(FS::getLockPath());
}
std::exit(0);
}
bool getTerminateSignal() {
return this->terminateSignal;
}
bool isReindexing() {
return this->reindexing;
}
bool setReindexing(bool value) {
this->reindexing = value;
}
uint32_t getReindexingHeight() {
return reindexingHeight;
}
void setReindexingHeight(uint32_t reindexingHeight) {
this->reindexingHeight = reindexingHeight;
}
bool isStarting() {
return this->starting;
}
void setIsStarting(bool isStarting) {
this->starting = isStarting;
}
};
#endif //TX_APP_H