summaryrefslogtreecommitdiff
path: root/include/mbgl/actor/scheduler.hpp
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-10-04 12:30:41 +0300
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-10-04 13:54:15 +0300
commitf024a3ed79e438b975301e5781b12739e150caf1 (patch)
tree47443222a5982031b4c9ecd531bea14edc61a8c8 /include/mbgl/actor/scheduler.hpp
parent198e3453394ccb2b1f7db72d1858cfd18e302a1e (diff)
downloadqtlocation-mapboxgl-f024a3ed79e438b975301e5781b12739e150caf1.tar.gz
[core] Decouple Scheduler interface from actor modelupstream/mikhail_decouple_scheduler_and_actor
So that it is possible to schedule normal `std::function` and use `mapbox::base::WeakPtr`.
Diffstat (limited to 'include/mbgl/actor/scheduler.hpp')
-rw-r--r--include/mbgl/actor/scheduler.hpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/include/mbgl/actor/scheduler.hpp b/include/mbgl/actor/scheduler.hpp
index 6470ab1245..ca34901cfd 100644
--- a/include/mbgl/actor/scheduler.hpp
+++ b/include/mbgl/actor/scheduler.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include <functional>
#include <memory>
namespace mbgl {
@@ -31,12 +32,9 @@ class Mailbox;
class Scheduler {
public:
virtual ~Scheduler() = default;
-
- // Used by a Mailbox when it has a message in its queue to request that it
- // be scheduled. Specifically, the scheduler is expected to asynchronously
- // call `receive() on the given mailbox, provided it still exists at that
- // time.
- virtual void schedule(std::weak_ptr<Mailbox>) = 0;
+
+ // Enqueues a function for execution.
+ virtual void schedule(std::function<void()>) = 0;
// Set/Get the current Scheduler for this thread
static Scheduler* GetCurrent();