Skip to content
This repository has been archived by the owner on Oct 5, 2024. It is now read-only.

Commit

Permalink
fix: Fix --rawdb option, make threading optional for easier debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
robsavoye committed May 20, 2024
1 parent e64ab97 commit 29b1156
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/underpass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ main(int argc, char *argv[])
("disable-raw", "Disable raw OSM data")
("norefs", "Disable refs (useful for non OSM data)")
("bootstrap", "Bootstrap data tables")
("silent", "Silent");
("rawdb", opts::value<std::string>(), "Database URI for raw OSM data");
("silent", "Silent")
("rawdb", opts::value<std::string>(), "Database URI for raw OSM data");
// clang-format on

opts::store(opts::command_line_parser(argc, argv).options(desc).positional(p).run(), vm);
Expand Down Expand Up @@ -306,8 +306,13 @@ main(int argc, char *argv[])
if (!config.silent) {
osmchange->dump();
}
#ifdef SINGLE_THREAD // debugging hack
replicatorthreads::startMonitorChanges(std::ref(osmchange),
std::ref(*osmboundary), config);
#else
osmChangeThread = std::thread(replicatorthreads::startMonitorChanges, std::ref(osmchange),
std::ref(*osmboundary), config);
#endif
}

// Changesets
Expand All @@ -326,18 +331,23 @@ main(int argc, char *argv[])
if (!config.silent) {
changeset->dump();
}
#ifdef SINGLE_THREAD // debugging hack
replicatorthreads::startMonitorChangesets(std::ref(changeset), std::ref(*oscboundary), config);
#else
changesetThread = std::thread(replicatorthreads::startMonitorChangesets,
std::ref(changeset), std::ref(*oscboundary), config);
#endif
}

// Start processing

#ifndef SINGLE_THREAD
if (changesetThread.joinable()) {
changesetThread.join();
}
if (osmChangeThread.joinable()) {
osmChangeThread.join();
}
#endif

exit(0);

Expand Down

0 comments on commit 29b1156

Please sign in to comment.