Join LAYOUT and DATA shared memory blocks into REGION
This commit is contained in:
committed by
Patrick Niklaus
parent
7b11cd3a11
commit
b376c97db8
@@ -13,22 +13,22 @@ 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")
|
||||
: 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")
|
||||
{
|
||||
}
|
||||
|
||||
static void resetCurrentRegions()
|
||||
static void resetCurrentRegion()
|
||||
{
|
||||
boost::interprocess::named_sharable_mutex::remove("current_regions");
|
||||
boost::interprocess::named_sharable_mutex::remove("current_region");
|
||||
}
|
||||
static void resetRegions1() { boost::interprocess::named_sharable_mutex::remove("regions_1"); }
|
||||
static void resetRegions2() { boost::interprocess::named_sharable_mutex::remove("regions_2"); }
|
||||
static void resetRegion1() { boost::interprocess::named_sharable_mutex::remove("region_1"); }
|
||||
static void resetRegion2() { boost::interprocess::named_sharable_mutex::remove("region_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;
|
||||
boost::interprocess::named_upgradable_mutex current_region_mutex;
|
||||
boost::interprocess::named_sharable_mutex region_1_mutex;
|
||||
boost::interprocess::named_sharable_mutex region_2_mutex;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,19 +192,15 @@ struct DataLayout
|
||||
|
||||
enum SharedDataType
|
||||
{
|
||||
CURRENT_REGIONS,
|
||||
LAYOUT_1,
|
||||
DATA_1,
|
||||
LAYOUT_2,
|
||||
DATA_2,
|
||||
LAYOUT_NONE,
|
||||
DATA_NONE
|
||||
CURRENT_REGION,
|
||||
REGION_1,
|
||||
REGION_2,
|
||||
REGION_NONE
|
||||
};
|
||||
|
||||
struct SharedDataTimestamp
|
||||
{
|
||||
SharedDataType layout;
|
||||
SharedDataType data;
|
||||
SharedDataType region;
|
||||
unsigned timestamp;
|
||||
};
|
||||
|
||||
@@ -212,20 +208,14 @@ inline std::string regionToString(const SharedDataType region)
|
||||
{
|
||||
switch (region)
|
||||
{
|
||||
case CURRENT_REGIONS:
|
||||
return "CURRENT_REGIONS";
|
||||
case LAYOUT_1:
|
||||
return "LAYOUT_1";
|
||||
case DATA_1:
|
||||
return "DATA_1";
|
||||
case LAYOUT_2:
|
||||
return "LAYOUT_2";
|
||||
case DATA_2:
|
||||
return "DATA_2";
|
||||
case LAYOUT_NONE:
|
||||
return "LAYOUT_NONE";
|
||||
case DATA_NONE:
|
||||
return "DATA_NONE";
|
||||
case CURRENT_REGION:
|
||||
return "CURRENT_REGION";
|
||||
case REGION_1:
|
||||
return "REGION_1";
|
||||
case REGION_2:
|
||||
return "REGION_2";
|
||||
case REGION_NONE:
|
||||
return "REGION_NONE";
|
||||
default:
|
||||
return "INVALID_REGION";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user