Skip to content

Commit

Permalink
improve TopicManager::instance (#770)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas committed Mar 18, 2016
1 parent c0bdb08 commit 8a0b80c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion clients/roscpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.3)
project(roscpp)

if(NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra")
endif()

find_package(catkin REQUIRED COMPONENTS
Expand Down
14 changes: 2 additions & 12 deletions clients/roscpp/src/libros/topic_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,10 @@ using namespace std; // sigh
namespace ros
{

TopicManagerPtr g_topic_manager;
boost::mutex g_topic_manager_mutex;
const TopicManagerPtr& TopicManager::instance()
{
if (!g_topic_manager)
{
boost::mutex::scoped_lock lock(g_topic_manager_mutex);
if (!g_topic_manager)
{
g_topic_manager = boost::make_shared<TopicManager>();
}
}

return g_topic_manager;
static TopicManagerPtr topic_manager = boost::make_shared<TopicManager>();
return topic_manager;
}

TopicManager::TopicManager()
Expand Down

0 comments on commit 8a0b80c

Please sign in to comment.