Skip to content

Commit

Permalink
Gather the results from each thread *after* the thread finishes
Browse files Browse the repository at this point in the history
  • Loading branch information
e-n-f committed Dec 20, 2024
1 parent 7338c4b commit 4788b67
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions tests/feature-filter/out/filtered.json.standard
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "0.000000,0.000000,0.000000,0.000000",
"bounds": "0.000000,0.000000,0.000000,0.000000",
"antimeridian_adjusted_bounds": "-180.000000,0.000000,0.966797,85.051129",
"bounds": "-180.000000,0.000000,0.966797,85.051129",
"center": "0.000000,0.000000,0",
"description": "tests/feature-filter/out/all.mbtiles",
"format": "pbf",
Expand Down
4 changes: 2 additions & 2 deletions tests/join-population/concat.mbtiles.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "0.000000,0.000000,0.000000,0.000000",
"bounds": "0.000000,0.000000,0.000000,0.000000",
"antimeridian_adjusted_bounds": "-122.255859,37.718590,-122.080078,37.857507",
"bounds": "-122.255859,37.718590,-122.080078,37.857507",
"center": "-122.104097,37.695438,0",
"description": "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
"format": "pbf",
Expand Down
4 changes: 2 additions & 2 deletions tests/join-population/joined-no-tile-stats.mbtiles.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-135.000000,37.877021,-122.280579,40.979898",
"bounds": "-135.000000,37.877021,-122.280579,40.979898",
"antimeridian_adjusted_bounds": "-135.000000,37.874853,-122.280579,40.979898",
"bounds": "-135.000000,37.874853,-122.280579,40.979898",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
Expand Down
4 changes: 2 additions & 2 deletions tests/join-population/joined-null.mbtiles.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-135.000000,37.877021,-122.280579,40.979898",
"bounds": "-135.000000,37.877021,-122.280579,40.979898",
"antimeridian_adjusted_bounds": "-135.000000,37.874853,-122.280579,40.979898",
"bounds": "-135.000000,37.874853,-122.280579,40.979898",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-135.000000,37.877021,-122.280579,40.979898",
"bounds": "-135.000000,37.877021,-122.280579,40.979898",
"antimeridian_adjusted_bounds": "-135.000000,37.874853,-122.280579,40.979898",
"bounds": "-135.000000,37.874853,-122.280579,40.979898",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-135.000000,37.877021,-122.280579,40.979898",
"bounds": "-135.000000,37.877021,-122.280579,40.979898",
"antimeridian_adjusted_bounds": "-135.000000,37.874853,-122.280579,40.979898",
"bounds": "-135.000000,37.874853,-122.280579,40.979898",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-135.000000,37.877021,-122.280579,40.979898",
"bounds": "-135.000000,37.877021,-122.280579,40.979898",
"antimeridian_adjusted_bounds": "-135.000000,37.874853,-122.280579,40.979898",
"bounds": "-135.000000,37.874853,-122.280579,40.979898",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
Expand Down
4 changes: 2 additions & 2 deletions tests/join-population/joined.mbtiles.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-135.000000,37.877021,-122.280579,40.979898",
"bounds": "-135.000000,37.877021,-122.280579,40.979898",
"antimeridian_adjusted_bounds": "-135.000000,37.874853,-122.280579,40.979898",
"bounds": "-135.000000,37.874853,-122.280579,40.979898",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
Expand Down
4 changes: 2 additions & 2 deletions tests/join-population/macarthur-6-9-exclude.mbtiles.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-122.294655,37.695231,-122.104111,37.833107",
"bounds": "-122.294655,37.695231,-122.104111,37.833107",
"antimeridian_adjusted_bounds": "-122.294655,37.695231,-122.103424,37.833107",
"bounds": "-122.294655,37.695231,-122.103424,37.833107",
"center": "-122.167969,37.833010,9",
"description": "tests/join-population/macarthur.mbtiles",
"format": "pbf",
Expand Down
4 changes: 2 additions & 2 deletions tests/join-population/macarthur-6-9.mbtiles.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-122.294655,37.695231,-122.104111,37.833107",
"bounds": "-122.294655,37.695231,-122.104111,37.833107",
"antimeridian_adjusted_bounds": "-122.294655,37.695231,-122.103424,37.833107",
"bounds": "-122.294655,37.695231,-122.103424,37.833107",
"center": "-122.167969,37.833010,9",
"description": "tests/join-population/macarthur.mbtiles",
"format": "pbf",
Expand Down
4 changes: 2 additions & 2 deletions tests/join-population/no-macarthur.mbtiles.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-135.000000,37.877021,-122.280579,40.979898",
"bounds": "-135.000000,37.877021,-122.280579,40.979898",
"antimeridian_adjusted_bounds": "-135.000000,37.874853,-122.280579,40.979898",
"bounds": "-135.000000,37.874853,-122.280579,40.979898",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
Expand Down
4 changes: 2 additions & 2 deletions tests/join-population/renamed.mbtiles.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-122.294655,37.695231,-122.103424,37.833107",
"bounds": "-122.294655,37.695231,-122.103424,37.833107",
"antimeridian_adjusted_bounds": "-122.294655,37.694688,-122.103424,37.833649",
"bounds": "-122.294655,37.694688,-122.103424,37.833649",
"center": "-122.167969,37.828608,10",
"description": "tests/join-population/macarthur2.mbtiles",
"format": "pbf",
Expand Down
4 changes: 2 additions & 2 deletions tests/join-population/windows.mbtiles.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-122.294655,37.695231,-122.103424,37.833107",
"bounds": "-122.294655,37.695231,-122.103424,37.833107",
"antimeridian_adjusted_bounds": "-122.294655,37.694688,-122.103424,37.833649",
"bounds": "-122.294655,37.694688,-122.103424,37.833649",
"center": "-122.167969,37.833010,10",
"description": "tests/join-population/macarthur.mbtiles",
"format": "pbf",
Expand Down
8 changes: 4 additions & 4 deletions tile-join.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1012,17 +1012,17 @@ 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);
*maxlon = std::max(*maxlon, args[i].maxlon);
*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());
Expand Down

0 comments on commit 4788b67

Please sign in to comment.