From 226c329bcaa98a10e7a75bddac5164f839fc8ba0 Mon Sep 17 00:00:00 2001 From: Anand Thakker Date: Fri, 15 Jun 2018 11:25:53 -0400 Subject: Fixup --- include/mbgl/util/thread.hpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/include/mbgl/util/thread.hpp b/include/mbgl/util/thread.hpp index 0cd12f6e95..9eecb64920 100644 --- a/include/mbgl/util/thread.hpp +++ b/include/mbgl/util/thread.hpp @@ -49,7 +49,8 @@ public: // we'll do on the target thread, once its RunLoop and Object instance // are ready. // Meanwhile, this allows us to immediately provide ActorRef using this - // mailbox to queue any messages that come in before the thread is ready. + // mailbox to queue any messages that come in before the thread is + // ready. (See actor().) std::shared_ptr mailbox_ = std::make_shared(); mailbox = mailbox_; @@ -68,6 +69,8 @@ public: util::RunLoop loop_(util::RunLoop::Type::New); loop = &loop_; + // Construct the Actor into the pre-allocated memory + // at `actorStorage`. Actor* actor = emplaceActor( std::move(sharedMailbox), std::move(tuple), @@ -116,8 +119,8 @@ public: // valid until the child thread constructs Actor into // actorStorage using "placement new". // We guarantee that the object reference isn't actually used by - // using the NoopScheduler to prevent messages to this mailbox from - // being processed until after the actor has been constructed. + // creating this mailbox without a scheduler, and only starting it + // after the actor has been constructed. auto actor = reinterpret_cast*>(&actorStorage); return ActorRef>(actor->object, mailbox); } @@ -173,7 +176,7 @@ private: } std::weak_ptr mailbox; - std::aligned_storage)> actorStorage; + std::aligned_storage_t)> actorStorage; std::thread thread; -- cgit v1.2.1