summaryrefslogtreecommitdiff
path: root/platform/qt/src/qmapboxgl_scheduler.hpp
blob: c23abf816db40cce938ba26ad11caf5aa3b945d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once

#include <mbgl/actor/mailbox.hpp>
#include <mbgl/actor/scheduler.hpp>

#include <QObject>

#include <memory>
#include <mutex>
#include <queue>

class QMapboxGLScheduler : public QObject, public mbgl::Scheduler
{
    Q_OBJECT

public:
    QMapboxGLScheduler();
    virtual ~QMapboxGLScheduler();

    // mbgl::Scheduler implementation.
    void schedule(std::weak_ptr<mbgl::Mailbox> scheduled) final;

    void processEvents();

signals:
    void needsProcessing();

private:
    std::mutex m_taskQueueMutex;
    std::queue<std::weak_ptr<mbgl::Mailbox>> m_taskQueue;
};