#pragma once #include "loader/module_loader.hpp" #include "utils/concurrent_list.hpp" class scheduler final : public module { public: static void on_frame(const std::function& callback); static void once(const std::function& callback); static void execute(); static void error(const std::string& message, int level); void pre_destroy() override; private: static std::mutex mutex_; static std::queue> errors_; static utils::concurrent_list> callbacks_; static utils::concurrent_list> single_callbacks_; static void execute_safe(); static void execute_error(); static bool get_next_error(const char** error_message, int* error_level); };