diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-10-10 11:43:17 +0300 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-10-10 15:39:34 +0300 |
commit | 2f973e9646b49f80c7af6851d38cf1029a31a232 (patch) | |
tree | 9858bf0bf9b600a2b14f03d7134f0823a3ec1405 /include/mbgl/actor | |
parent | 76346944f3f6809bed7dd7ce4ef82343fc069423 (diff) | |
download | qtlocation-mapboxgl-2f973e9646b49f80c7af6851d38cf1029a31a232.tar.gz |
[core] Introduce Scheduler::bindOnce() and use it in ImageManager
Diffstat (limited to 'include/mbgl/actor')
-rw-r--r-- | include/mbgl/actor/scheduler.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/mbgl/actor/scheduler.hpp b/include/mbgl/actor/scheduler.hpp index 7338c3ab3a..bb2cf124b8 100644 --- a/include/mbgl/actor/scheduler.hpp +++ b/include/mbgl/actor/scheduler.hpp @@ -40,6 +40,16 @@ public: // Makes a weak pointer to this Scheduler. virtual mapbox::base::WeakPtr<Scheduler> makeWeakPtr() = 0; + // Returns a closure wrapping the given one. + // + // When the returned closure is invoked for the first time, it schedules + // the given closure to this scheduler, the consequent calls of the + // returned closure are ignored. + // + // If this scheduler is already deleted by the time the returnded closure is + // first invoked, the call is ignored. + std::function<void()> bindOnce(std::function<void()>); + // Set/Get the current Scheduler for this thread static Scheduler* GetCurrent(); static void SetCurrent(Scheduler*); |