[core] extract weak_ptr mailbox->receive into Mailbox::maybeReceive

This commit is contained in:
Mike Morris
2016-10-12 22:32:55 -04:00
parent a894870fb8
commit 7bbd49c72c
5 changed files with 11 additions and 9 deletions

View File

@@ -52,4 +52,10 @@ void Mailbox::receive() {
}
}
void Mailbox::maybeReceive(std::weak_ptr<Mailbox> mailbox) {
if (auto locked = mailbox.lock()) {
locked->receive();
}
}
} // namespace mbgl

View File

@@ -18,6 +18,8 @@ public:
void close();
void receive();
static void maybeReceive(std::weak_ptr<Mailbox>);
private:
Scheduler& scheduler;