2015-01-27 06:35:29 -05:00
|
|
|
#ifndef SHARED_BARRIERS_HPP
|
|
|
|
#define SHARED_BARRIERS_HPP
|
2011-01-09 16:42:27 -05:00
|
|
|
|
2016-10-07 10:08:08 -04:00
|
|
|
#include <boost/interprocess/sync/named_sharable_mutex.hpp>
|
2016-10-07 19:52:47 -04:00
|
|
|
#include <boost/interprocess/sync/named_upgradable_mutex.hpp>
|
2011-01-09 16:42:27 -05:00
|
|
|
|
2016-01-05 10:51:13 -05:00
|
|
|
namespace osrm
|
|
|
|
{
|
2016-01-07 13:19:55 -05:00
|
|
|
namespace storage
|
2016-01-05 10:51:13 -05:00
|
|
|
{
|
2016-10-07 19:52:47 -04:00
|
|
|
|
2015-01-27 06:35:29 -05:00
|
|
|
struct SharedBarriers
|
2014-05-07 10:50:48 -04:00
|
|
|
{
|
2013-12-13 17:26:57 -05:00
|
|
|
|
2015-01-27 06:35:29 -05:00
|
|
|
SharedBarriers()
|
2016-12-22 18:18:57 -05:00
|
|
|
: current_region_mutex(boost::interprocess::open_or_create, "current_region"),
|
|
|
|
region_1_mutex(boost::interprocess::open_or_create, "region_1"),
|
|
|
|
region_2_mutex(boost::interprocess::open_or_create, "region_2")
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-12-22 18:18:57 -05:00
|
|
|
static void resetCurrentRegion()
|
2016-10-12 15:26:59 -04:00
|
|
|
{
|
2016-12-22 18:18:57 -05:00
|
|
|
boost::interprocess::named_sharable_mutex::remove("current_region");
|
2016-10-12 15:26:59 -04:00
|
|
|
}
|
2016-12-22 18:18:57 -05:00
|
|
|
static void resetRegion1() { boost::interprocess::named_sharable_mutex::remove("region_1"); }
|
|
|
|
static void resetRegion2() { boost::interprocess::named_sharable_mutex::remove("region_2"); }
|
2016-10-12 15:26:59 -04:00
|
|
|
|
2016-12-22 18:18:57 -05:00
|
|
|
boost::interprocess::named_upgradable_mutex current_region_mutex;
|
|
|
|
boost::interprocess::named_sharable_mutex region_1_mutex;
|
|
|
|
boost::interprocess::named_sharable_mutex region_2_mutex;
|
2011-01-09 16:42:27 -05:00
|
|
|
};
|
2016-01-05 10:51:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-27 06:35:29 -05:00
|
|
|
#endif // SHARED_BARRIERS_HPP
|