summaryrefslogtreecommitdiff
path: root/src/mbgl/geometry/line_atlas.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-08-14 18:12:04 +0300
committerKonstantin Käfer <mail@kkaefer.com>2015-08-19 14:42:09 -0400
commit90bae75838f223a88a08a43380b405ec5e373591 (patch)
tree97329f687758cfebb972c0c51628fe766f8d4c37 /src/mbgl/geometry/line_atlas.cpp
parent31555bccca9a9565c24e2af94629031bcc2d65f8 (diff)
downloadqtlocation-mapboxgl-90bae75838f223a88a08a43380b405ec5e373591.tar.gz
remove mutex from LineAtlas
we're only ever accessing it from the Map thread, so there's no need for a mutex, even less for a recursive one
Diffstat (limited to 'src/mbgl/geometry/line_atlas.cpp')
-rw-r--r--src/mbgl/geometry/line_atlas.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mbgl/geometry/line_atlas.cpp b/src/mbgl/geometry/line_atlas.cpp
index 0c16294d53..aeac3067e9 100644
--- a/src/mbgl/geometry/line_atlas.cpp
+++ b/src/mbgl/geometry/line_atlas.cpp
@@ -20,7 +20,7 @@ LineAtlas::LineAtlas(uint16_t w, uint16_t h)
}
LineAtlas::~LineAtlas() {
- std::lock_guard<std::recursive_mutex> lock(mtx);
+ assert(util::ThreadContext::currentlyOn(util::ThreadType::Map));
if (texture) {
mbgl::util::ThreadContext::getGLObjectStore()->abandonTexture(texture);
@@ -29,14 +29,14 @@ LineAtlas::~LineAtlas() {
}
LinePatternPos LineAtlas::getDashPosition(const std::vector<float> &dasharray, bool round) {
+ assert(util::ThreadContext::currentlyOn(util::ThreadType::Map));
+
size_t key = round ? std::numeric_limits<size_t>::min() : std::numeric_limits<size_t>::max();
for (const float part : dasharray) {
boost::hash_combine<float>(key, part);
}
// Note: We're not handling hash collisions here.
-
- std::lock_guard<std::recursive_mutex> lock(mtx);
const auto it = positions.find(key);
if (it == positions.end()) {
auto inserted = positions.emplace(key, addDash(dasharray, round));
@@ -137,7 +137,7 @@ void LineAtlas::upload() {
}
void LineAtlas::bind() {
- std::lock_guard<std::recursive_mutex> lock(mtx);
+ assert(util::ThreadContext::currentlyOn(util::ThreadType::Map));
bool first = false;
if (!texture) {