Improved android networking

This commit is contained in:
Yousef Khadadeh 2026-05-14 11:53:36 +03:00
parent a533494b3a
commit ad1844adc7
27 changed files with 568 additions and 69 deletions

27
src/NetThreadManager.hpp Normal file
View file

@ -0,0 +1,27 @@
#pragma once
#include <thread>
#include <mutex>
#include <functional>
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<std::thread> t;
std::atomic<bool> destroyThread = false;
bool started = false;
};