[core] extract weak_ptr mailbox->receive into Mailbox::maybeReceive
This commit is contained in:
@@ -52,4 +52,10 @@ void Mailbox::receive() {
|
||||
}
|
||||
}
|
||||
|
||||
void Mailbox::maybeReceive(std::weak_ptr<Mailbox> mailbox) {
|
||||
if (auto locked = mailbox.lock()) {
|
||||
locked->receive();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -18,6 +18,8 @@ public:
|
||||
void close();
|
||||
void receive();
|
||||
|
||||
static void maybeReceive(std::weak_ptr<Mailbox>);
|
||||
|
||||
private:
|
||||
Scheduler& scheduler;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user