#pragma once class CPUThread; class CallbackManager { using check_cb_t = std::function; using async_cb_t = std::function; std::mutex m_mutex; std::queue m_check_cb; std::queue m_async_cb; std::shared_ptr m_cb_thread; public: // register checked callback (accepts CPUThread&, returns s32) void Register(check_cb_t func); // register async callback, called in callback thread (accepts CPUThread&) void Async(async_cb_t func); // get one registered callback check_cb_t Check(); void Init(); void Clear(); };