Don't block all requests to switch data

This switchtes the data even if there are requests still running on the
old data. osrm-datastore then waits until all of these old requests have
finished before freeing the old regions.

This also means that osrm-datastore will return with an error if there
is a data update currenlty in progress.
This commit is contained in:
Patrick Niklaus
2016-10-08 01:52:47 +02:00
committed by Patrick Niklaus
parent 1557ff81bc
commit c69545c47a
6 changed files with 150 additions and 85 deletions
+4 -3
View File
@@ -7,8 +7,9 @@ int main()
{
osrm::util::LogPolicy::GetInstance().Unmute();
osrm::util::SimpleLogger().Write() << "Releasing all locks";
osrm::storage::SharedBarriers barrier;
barrier.pending_update_mutex.unlock();
barrier.query_mutex.unlock();
osrm::storage::SharedBarriers barriers;
boost::interprocess::named_upgradable_mutex::remove("current_regions");
boost::interprocess::named_sharable_mutex::remove("regions_1");
boost::interprocess::named_sharable_mutex::remove("regions_2");
return 0;
}