-
Notifications
You must be signed in to change notification settings - Fork 74
v0.2.54..v0.2.55 changeset Hoot.cpp
Garret Voltz edited this page Aug 14, 2020
·
1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/Hoot.cpp b/hoot-core/src/main/cpp/hoot/core/Hoot.cpp
index c3de4a0..89c6e43 100644
--- a/hoot-core/src/main/cpp/hoot/core/Hoot.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/Hoot.cpp
@@ -60,8 +60,6 @@ using namespace std;
namespace hoot
{
-std::shared_ptr<Hoot> Hoot::_theInstance;
-
Hoot::Hoot()
{
_init();
@@ -69,11 +67,9 @@ Hoot::Hoot()
Hoot& Hoot::getInstance()
{
- if (_theInstance.get() == 0)
- {
- _theInstance.reset(new Hoot());
- }
- return *_theInstance;
+ /** Hootenanny singletons follow the Meyers' Singleton pattern seen below */
+ static Hoot instance;
+ return instance;
}
void Hoot::_init()
@@ -92,7 +88,7 @@ void Hoot::_init()
Tgs::Stxxl::getInstance().setConfig(stxxlConf);
# endif
- SignalCatcher::getInstance()->registerDefaultHandlers();
+ SignalCatcher::getInstance().registerDefaultHandlers();
// All streams will default to UTF-8. This makes supporting other scripts much easier.
setlocale(LC_ALL, "en_US.UTF-8");