Added a run_at, run_every and run_on_start, making the app a daemon like entity.
This commit is contained in:
parent
111c2487d8
commit
41c405a0c5
1 changed files with 694 additions and 46 deletions
|
|
@ -21,6 +21,9 @@ class ExecutionManager
|
|||
std::atomic<int> active_thread_count = 0;
|
||||
std::vector<std::shared_ptr<std::thread>> thread_list;
|
||||
std::vector<std::shared_ptr<AppInfo>> job_list;
|
||||
std::vector<std::shared_ptr<AppInfo>> scheduled_list;
|
||||
std::chrono::system_clock::time_point last_poll_time;
|
||||
int polling_interval = 1;
|
||||
Log log_file;
|
||||
public:
|
||||
ExecutionManager(int threads=16);
|
||||
|
|
@ -28,7 +31,12 @@ public:
|
|||
void setLogFileMaxSize(long long int size);
|
||||
void setLogDirectoy(std::string log_dir);
|
||||
void setJobs(std::vector<std::shared_ptr<AppInfo>>& job_list);
|
||||
void printActiveJobs();
|
||||
void run();
|
||||
private:
|
||||
bool checkScheduledTaskIsReady(std::chrono::system_clock::time_point next_time);
|
||||
void seperateScheduledTasks();
|
||||
void pollScheduledTasks();
|
||||
};
|
||||
|
||||
#endif // EXECUTIONMANAGER_H
|
||||
|
|
|
|||
Loading…
Reference in a new issue