2018-12-27 17:11:52 +01:00
|
|
|
#pragma once
|
|
|
|
#include "loader/module_loader.hpp"
|
|
|
|
|
|
|
|
class scheduler final : public module
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static void on_frame(const std::function<void()>& callback);
|
2018-12-28 12:50:34 +01:00
|
|
|
static void once(const std::function<void()>& callback);
|
2018-12-27 17:11:52 +01:00
|
|
|
static void execute();
|
|
|
|
|
2019-01-16 16:19:21 +01:00
|
|
|
static void error(const std::string& message, int level);
|
|
|
|
|
2018-12-27 17:11:52 +01:00
|
|
|
void pre_destroy() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
static std::mutex mutex_;
|
2019-01-16 16:19:21 +01:00
|
|
|
static std::queue<std::pair<std::string, int>> errors_;
|
2018-12-27 17:11:52 +01:00
|
|
|
static std::vector<std::function<void()>> callbacks_;
|
2018-12-28 12:50:34 +01:00
|
|
|
static std::vector<std::function<void()>> single_callbacks_;
|
2019-01-16 16:19:21 +01:00
|
|
|
|
|
|
|
static void execute_safe();
|
|
|
|
static void execute_error();
|
|
|
|
static bool get_next_error(const char** error_message, int* error_level);
|
2018-12-27 17:11:52 +01:00
|
|
|
};
|