summaryrefslogtreecommitdiff
path: root/src/resolver.cpp
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2014-06-29 00:06:23 +0000
committerChristian Pointner <equinox@anytun.org>2014-06-29 00:06:23 +0000
commit92a551b96e625257def26771155ebd64c6d8757e (patch)
tree7d5b2d0a043f746bfb10ccc9679ac59646a95b72 /src/resolver.cpp
parentwhile(1) vs. for(;;) (diff)
fixed not working singletons - still not threadsafe but at least they don't pretend to be
Diffstat (limited to 'src/resolver.cpp')
-rw-r--r--src/resolver.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/resolver.cpp b/src/resolver.cpp
index afca093..aae1f5f 100644
--- a/src/resolver.cpp
+++ b/src/resolver.cpp
@@ -80,19 +80,12 @@ void ResolveHandler<Proto>::operator()(const boost::system::error_code& e, boost
}
}
-Resolver* Resolver::inst = NULL;
-Mutex Resolver::instMutex;
Resolver& gResolver = Resolver::instance();
Resolver& Resolver::instance()
{
- Lock lock(instMutex);
- static instanceCleaner c;
- if(!inst) {
- inst = new Resolver();
- }
-
- return *inst;
+ static Resolver instance;
+ return instance;
}
Resolver::Resolver() : udp_resolver_(io_service_), tcp_resolver_(io_service_), thread_(NULL)