Improved android networking
This commit is contained in:
parent
a533494b3a
commit
ad1844adc7
27 changed files with 568 additions and 69 deletions
27
src/NetThreadManager.hpp
Normal file
27
src/NetThreadManager.hpp
Normal 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;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue