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.
		
			
				
	
	
		
			31 lines
		
	
	
		
			755 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			755 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #ifndef SHARED_BARRIERS_HPP
 | |
| #define SHARED_BARRIERS_HPP
 | |
| 
 | |
| #include <boost/interprocess/sync/named_sharable_mutex.hpp>
 | |
| #include <boost/interprocess/sync/named_upgradable_mutex.hpp>
 | |
| 
 | |
| namespace osrm
 | |
| {
 | |
| namespace storage
 | |
| {
 | |
| 
 | |
| struct SharedBarriers
 | |
| {
 | |
| 
 | |
|     SharedBarriers()
 | |
|         : current_regions_mutex(boost::interprocess::open_or_create, "current_regions"),
 | |
|           regions_1_mutex(boost::interprocess::open_or_create, "regions_1"),
 | |
|           regions_2_mutex(boost::interprocess::open_or_create, "regions_2")
 | |
|     {
 | |
|     }
 | |
| 
 | |
|     boost::interprocess::named_upgradable_mutex current_regions_mutex;
 | |
|     boost::interprocess::named_sharable_mutex regions_1_mutex;
 | |
|     boost::interprocess::named_sharable_mutex regions_2_mutex;
 | |
| };
 | |
| 
 | |
| }
 | |
| }
 | |
| 
 | |
| #endif // SHARED_BARRIERS_HPP
 |