#pragma once #include #include #include class MainProgram; class NetThreadManager { public: static NetThreadManager& get(); void init(MainProgram* m); void thread_update(); void destroy(); void init_thread(); void destroy_thread(); void go_to_background(); void go_to_foreground(); private: static NetThreadManager global; MainProgram* main; std::mutex backgroundUpdateMutex; bool backgroundUpdate = false; std::unique_ptr t; std::atomic destroyThread = false; bool started = false; };