Gather the results from each thread *after* the thread finishes

This commit is contained in:
Erica Fischer
2024-12-20 09:42:09 -08:00
parent 7338c4b6b0
commit 4788b67a54
14 changed files with 30 additions and 30 deletions
+4 -4
View File
@@ -1012,6 +1012,10 @@ void dispatch_tasks(std::map<zxy, std::vector<std::string>> &tasks, std::vector<
for (size_t i = 0; i < CPUS; i++) {
void *retval;
if (pthread_join(pthreads[i], &retval) != 0) {
perror("pthread_join");
}
*minlat = std::min(*minlat, args[i].minlat);
*minlon = std::min(*minlon, args[i].minlon);
*maxlat = std::max(*maxlat, args[i].maxlat);
@@ -1019,10 +1023,6 @@ void dispatch_tasks(std::map<zxy, std::vector<std::string>> &tasks, std::vector<
*minlon2 = std::min(*minlon2, args[i].minlon2);
*maxlon2 = std::max(*maxlon2, args[i].maxlon2);
if (pthread_join(pthreads[i], &retval) != 0) {
perror("pthread_join");
}
for (auto ai = args[i].outputs.begin(); ai != args[i].outputs.end(); ++ai) {
if (outdb != NULL) {
mbtiles_write_tile(outdb, ai->first.z, ai->first.x, ai->first.y, ai->second.data(), ai->second.size());