1 #pragma once
2 
3 #include <mbgl/util/async_task.hpp>
4 
5 #include <QObject>
6 
7 #include <functional>
8 #include <atomic>
9 
10 namespace mbgl {
11 namespace util {
12 
13 class RunLoop;
14 
15 class AsyncTask::Impl : public QObject {
16     Q_OBJECT
17 
18 public:
19     Impl(std::function<void()> &&);
20 
21     void maySend();
22 
23 public slots:
24     void runTask();
25 
26 signals:
27     void send();
28 
29 private:
30     RunLoop* runLoop;
31 
32     std::function<void()> task;
33     std::atomic_flag queued = ATOMIC_FLAG_INIT;
34 };
35 
36 
37 } // namespace util
38 } // namespace mbgl
39