Revert "[node] Destroy the RunLoop with the last Map object"
This reverts commit 3633fd7ebd.
This commit is contained in:
@@ -12,21 +12,19 @@
|
||||
|
||||
namespace node_mbgl {
|
||||
|
||||
std::shared_ptr<mbgl::util::RunLoop> NodeRunLoop() {
|
||||
static std::weak_ptr<mbgl::util::RunLoop> nodeRunLoop;
|
||||
|
||||
auto loop = nodeRunLoop.lock();
|
||||
if (!loop) {
|
||||
loop = std::make_shared<mbgl::util::RunLoop>();
|
||||
nodeRunLoop = loop;
|
||||
}
|
||||
|
||||
return std::move(loop);
|
||||
mbgl::util::RunLoop& NodeRunLoop() {
|
||||
static mbgl::util::RunLoop nodeRunLoop;
|
||||
return nodeRunLoop;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NAN_MODULE_INIT(RegisterModule) {
|
||||
// This has the effect of:
|
||||
// a) Ensuring that the static local variable is initialized before any thread contention.
|
||||
// b) unreffing an async handle, which otherwise would keep the default loop running.
|
||||
node_mbgl::NodeRunLoop().stop();
|
||||
|
||||
node_mbgl::NodeMap::Init(target);
|
||||
node_mbgl::NodeRequest::Init(target);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user