From 4315a113935902bbbb82047e3f43695b4d76fff2 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 17 Jun 2015 15:38:00 +0100 Subject: Fixed and improved restarting Restarts are now an actual, close-as-possible to application exit+reopen. --- src/OSSupport/NetworkSingleton.cpp | 53 ++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 22 deletions(-) (limited to 'src/OSSupport/NetworkSingleton.cpp') diff --git a/src/OSSupport/NetworkSingleton.cpp b/src/OSSupport/NetworkSingleton.cpp index 417fab01e..c16f92c5a 100644 --- a/src/OSSupport/NetworkSingleton.cpp +++ b/src/OSSupport/NetworkSingleton.cpp @@ -18,8 +18,36 @@ -cNetworkSingleton::cNetworkSingleton(void): - m_HasTerminated(false) +cNetworkSingleton::cNetworkSingleton() : + m_HasTerminated(true) +{ +} + + + + + +cNetworkSingleton::~cNetworkSingleton() +{ + // Check that Terminate has been called already: + ASSERT(m_HasTerminated); +} + + + + + +cNetworkSingleton & cNetworkSingleton::Get(void) +{ + static cNetworkSingleton Instance; + return Instance; +} + + + + + +void cNetworkSingleton::Initialise(void) { // Windows: initialize networking: #ifdef _WIN32 @@ -64,26 +92,7 @@ cNetworkSingleton::cNetworkSingleton(void): // Create the event loop thread: m_EventLoopThread = std::thread(RunEventLoop, this); -} - - - - - -cNetworkSingleton::~cNetworkSingleton() -{ - // Check that Terminate has been called already: - ASSERT(m_HasTerminated); -} - - - - - -cNetworkSingleton & cNetworkSingleton::Get(void) -{ - static cNetworkSingleton Instance; - return Instance; + m_HasTerminated = false; } -- cgit v1.2.3