Files
MapLibreParticleLab/include/mbgl/storage/network_status.hpp
Thiago Marcos P. Santos b8b283588f [core] Remove goOffline() from DefaultFileSource
Use the newly added NetworkStatus::Set().
2016-03-08 10:31:01 -03:00

38 lines
646 B
C++

#ifndef MBGL_STORAGE_NETWORK_STATUS
#define MBGL_STORAGE_NETWORK_STATUS
#include <atomic>
#include <mutex>
#include <set>
namespace mbgl {
namespace util {
class AsyncTask;
} // namespace util
class NetworkStatus {
public:
enum class Status : uint8_t {
Online,
Offline,
};
static Status Get();
static 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;
};
} // namespace mbgl
#endif