summaryrefslogtreecommitdiff
path: root/src/mbgl/actor
diff options
context:
space:
mode:
authorMike Morris <mikemorris@users.noreply.github.com>2016-10-12 22:32:55 -0400
committerMike Morris <mikemorris@users.noreply.github.com>2016-10-20 14:39:11 -0400
commit7bbd49c72c0daa7036a575a49f6cf13bf8a7020e (patch)
treeee3ba73132d35d789640f59c860fddf2a4a49ef8 /src/mbgl/actor
parenta894870fb8f99632570ec1379fb55b287273fc58 (diff)
downloadqtlocation-mapboxgl-7bbd49c72c0daa7036a575a49f6cf13bf8a7020e.tar.gz
[core] extract weak_ptr mailbox->receive into Mailbox::maybeReceive
Diffstat (limited to 'src/mbgl/actor')
-rw-r--r--src/mbgl/actor/mailbox.cpp6
-rw-r--r--src/mbgl/actor/mailbox.hpp2
2 files changed, 8 insertions, 0 deletions
diff --git a/src/mbgl/actor/mailbox.cpp b/src/mbgl/actor/mailbox.cpp
index ae3c0967af..5f60629833 100644
--- a/src/mbgl/actor/mailbox.cpp
+++ b/src/mbgl/actor/mailbox.cpp
@@ -52,4 +52,10 @@ void Mailbox::receive() {
}
}
+void Mailbox::maybeReceive(std::weak_ptr<Mailbox> mailbox) {
+ if (auto locked = mailbox.lock()) {
+ locked->receive();
+ }
+}
+
} // namespace mbgl
diff --git a/src/mbgl/actor/mailbox.hpp b/src/mbgl/actor/mailbox.hpp
index 5d5e8cb924..cff0de243a 100644
--- a/src/mbgl/actor/mailbox.hpp
+++ b/src/mbgl/actor/mailbox.hpp
@@ -18,6 +18,8 @@ public:
void close();
void receive();
+ static void maybeReceive(std::weak_ptr<Mailbox>);
+
private:
Scheduler& scheduler;