virtual ~LocalServer(void) { QuitAndWait(); // Clear the connection flags... AtomicExchange(g_connectionFlags, (UInt32)0); if(g_onDisconnect) { // After the connection is fully shut down, notify the app. g_onDisconnect(); } // Clear the buffers for all AsyncStreams to guarantee that no event is // stalled waiting for room on a buffer. Then we wait until there there // are no events still writing out. AsyncStream::ClearAll(); while(AtomicGet(g_refcount) > 0) { ThreadSleepMilliseconds(1); } // Finally, release any AsyncStreams that were created during this session // now that we can safely assume there are no events actively trying to // write out to a stream. AsyncStream::Shutdown(); g_varStore.Clear(); if(m_file != NullFileHandle) { CloseFile(m_file); m_file = NullFileHandle; } }
virtual ~Server(void) { // Signal and wait for quit... if(m_listenSocket) m_listenSocket->Shutdown(); QuitAndWait(); // Cleanup just in case the thread doesn't... if(m_zeroconfig) m_zeroconfig->Release(); if(m_streamSocket) m_streamSocket->Release(); if(m_listenSocket) m_listenSocket->Release(); }
virtual ~RemoteServer(void) { // Signal and wait for quit... if(m_listenSocket) m_listenSocket->Shutdown(); QuitAndWait(); // Cleanup just in case the thread doesn't... if(m_streamSocket) m_streamSocket->Release(); if(m_listenSocket) m_listenSocket->Release(); #if defined(OVR_CAPTURE_WINDOWS) // WinSock reference counts... WSACleanup(); #endif }
Thread::~Thread(void) { QuitAndWait(); }