summaryrefslogtreecommitdiff
path: root/include/mbgl/storage/network_status.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl/storage/network_status.hpp')
-rw-r--r--include/mbgl/storage/network_status.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/mbgl/storage/network_status.hpp b/include/mbgl/storage/network_status.hpp
index 2a0ab78edd..4202793661 100644
--- a/include/mbgl/storage/network_status.hpp
+++ b/include/mbgl/storage/network_status.hpp
@@ -1,6 +1,7 @@
#ifndef MBGL_STORAGE_NETWORK_STATUS
#define MBGL_STORAGE_NETWORK_STATUS
+#include <atomic>
#include <mutex>
#include <set>
@@ -12,12 +13,21 @@ class AsyncTask;
class NetworkStatus {
public:
+ enum class Status : uint8_t {
+ Online,
+ Offline,
+ };
+
+ Status Get();
+ void Set(Status);
+
static void Reachable();
static void Subscribe(util::AsyncTask* async);
static void Unsubscribe(util::AsyncTask* async);
private:
+ static std::atomic<bool> online;
static std::mutex mtx;
static std::set<util::AsyncTask*> observers;
};