make shmem swappable by ref and ptr
This commit is contained in:
parent
843348338a
commit
5afed2d396
@ -108,12 +108,32 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void Swap(SharedMemory & other) {
|
||||
SimpleLogger().Write() << "prev: " << shm.get_shmid();
|
||||
shm.swap(other.shm);
|
||||
region.swap(other.region);
|
||||
boost::interprocess::xsi_key temp_key = other.key;
|
||||
other.key = key;
|
||||
key = temp_key;
|
||||
SimpleLogger().Write() << "after: " << shm.get_shmid();
|
||||
}
|
||||
|
||||
void Swap(SharedMemory * other) {
|
||||
SimpleLogger().Write() << "prev: " << shm.get_shmid();
|
||||
shm.swap(other->shm);
|
||||
region.swap(other->region);
|
||||
boost::interprocess::xsi_key temp_key = other->key;
|
||||
other->key = key;
|
||||
key = temp_key;
|
||||
SimpleLogger().Write() << "after: " << shm.get_shmid();
|
||||
}
|
||||
|
||||
template<typename IdentifierT >
|
||||
static bool RegionExists(
|
||||
const boost::filesystem::path & lock_file,
|
||||
const IdentifierT id
|
||||
) {
|
||||
boost::interprocess::xsi_key key( lock_file.string().c_str(), id );
|
||||
OSRMLockFile lock_file;
|
||||
boost::interprocess::xsi_key key( lock_file().string().c_str(), id );
|
||||
return RegionExists(key);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user