use separate workers for tile parsing to avoid blocking the threadpool for other libuv actions

This commit is contained in:
Konstantin Käfer
2014-09-16 18:23:42 +02:00
parent f26bb724dc
commit fd2b2e2082
9 changed files with 89 additions and 23 deletions

View File

@@ -60,6 +60,13 @@ Map::~Map() {
}
}
uv::worker &Map::getWorker() {
if (!workers) {
workers = std::make_unique<uv::worker>(**loop, 4, "Tile Worker");
}
return *workers;
}
void Map::start() {
assert(uv_thread_self() == main_thread);
assert(!async);
@@ -198,6 +205,7 @@ void Map::terminate(uv_async_t *async) {
map->glyphStore.reset();
map->fileSource.reset();
map->style.reset();
map->workers.reset();
map->activeSources.clear();
uv_close((uv_handle_t *)map->async_cleanup.get(), nullptr);