Skip to content

Commit

Permalink
move global variable to local static variable
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshito-okada committed Apr 9, 2018
1 parent 36bcba1 commit de4b37d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions epos_hardware/src/util/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ DeviceHandle::DeviceHandle(const DeviceInfo &device_info) : ptr(makePtr(device_i

DeviceHandle::~DeviceHandle() {}

// global storage of opened devices
std::map< DeviceInfo, boost::weak_ptr< void >, LessDeviceInfo > existing_device_ptrs;

boost::shared_ptr< void > DeviceHandle::makePtr(const DeviceInfo &device_info) {
// shared storage of opened devices
static std::map< DeviceInfo, boost::weak_ptr< void >, LessDeviceInfo > existing_device_ptrs;

// try find an existing device
const boost::shared_ptr< void > existing_device_ptr(existing_device_ptrs[device_info].lock());
if (existing_device_ptr) {
Expand Down

0 comments on commit de4b37d

Please sign in to comment.