summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorŁukasz Paczos <lukas.paczos@gmail.com>2019-05-21 12:45:01 +0200
committerŁukasz Paczos <lukasz.paczos@mapbox.com>2019-05-22 15:52:55 +0200
commit7d6255c8605bd18a7c7d90de19346392a51c90b7 (patch)
tree65b52ac4f4b4e64598dcc885a161251d62c5d38e /include
parente79080771b36ad3a4be0dee8ca12032cd1c8488a (diff)
downloadqtlocation-mapboxgl-7d6255c8605bd18a7c7d90de19346392a51c90b7.tar.gz
[core] option to perform platform specific operations when creating/destroying core threads
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/platform/thread.hpp13
-rw-r--r--include/mbgl/util/thread.hpp3
2 files changed, 16 insertions, 0 deletions
diff --git a/include/mbgl/platform/thread.hpp b/include/mbgl/platform/thread.hpp
new file mode 100644
index 0000000000..72899a4fd8
--- /dev/null
+++ b/include/mbgl/platform/thread.hpp
@@ -0,0 +1,13 @@
+#pragma once
+
+namespace mbgl {
+namespace platform {
+
+// Called when a thread is created
+void attachThread();
+
+// Called when a thread is destroyed
+void detachThread();
+
+} // namespace platform
+} // namespace mbgl
diff --git a/include/mbgl/util/thread.hpp b/include/mbgl/util/thread.hpp
index bc58427349..0e9bd8f759 100644
--- a/include/mbgl/util/thread.hpp
+++ b/include/mbgl/util/thread.hpp
@@ -6,6 +6,7 @@
#include <mbgl/util/platform.hpp>
#include <mbgl/util/run_loop.hpp>
#include <mbgl/util/util.hpp>
+#include <mbgl/platform/thread.hpp>
#include <cassert>
#include <future>
@@ -55,6 +56,7 @@ public:
] () mutable {
platform::setCurrentThreadName(name);
platform::makeThreadLowPriority();
+ platform::attachThread();
util::RunLoop loop_(util::RunLoop::Type::New);
loop = &loop_;
@@ -67,6 +69,7 @@ public:
(void) establishedActor;
loop = nullptr;
+ platform::detachThread();
});
}