osrm-backend/include/storage/shared_barriers.hpp

43 lines
1.1 KiB
C++
Raw Normal View History

#ifndef SHARED_BARRIERS_HPP
#define SHARED_BARRIERS_HPP
#include <boost/interprocess/sync/named_sharable_mutex.hpp>
#include <boost/interprocess/sync/named_upgradable_mutex.hpp>
2016-01-05 10:51:13 -05:00
namespace osrm
{
namespace storage
2016-01-05 10:51:13 -05:00
{
struct SharedBarriers
{
2013-12-13 17:26:57 -05:00
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")
{
}
static void resetCurrentRegions()
{
boost::interprocess::named_sharable_mutex::remove("current_regions");
}
static void resetRegions1()
{
boost::interprocess::named_sharable_mutex::remove("regions_1");
}
static void resetRegions2()
{
boost::interprocess::named_sharable_mutex::remove("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;
};
2016-01-05 10:51:13 -05:00
}
}
#endif // SHARED_BARRIERS_HPP