![]() |
Shutdown() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Public Function |
Declared in: AsyncSocket.h |
static void Shutdown();
Indicate a system shutdown Can be called by user, but will be invoked automatically
try { //Only if initialized if (!m_bInitialized) return; if (!m_pCSection) { //Report it ReportStaticError(CAsyncSocket_Class,"Shutdown","Critical section not initialized"); //Exit return; } //Enter the CS CCriticalAutoRelease aRelease(m_pCSection); //Indicate we're shutting down m_bShuttingDown=TRUE; //Our vector of sockets typedef std::vector<CAsyncSocket*> SocketVector; SocketVector aVector; //Clear the map SocketMap::iterator aIterator; aIterator=m_aSocketMap.begin(); //While not end of the map while (aIterator!=m_aSocketMap.end()) { //Add the socket aVector.push_back(aIterator->second); //Next data ++aIterator; } //Exit the CS aRelease.Exit(); //Iterate the vector while (!aVector.empty()) { //Get the socket CAsyncSocket* pSocket; pSocket=aVector.back(); //Remove the socket aVector.pop_back(); //Try to delete it try { delete pSocket; } ERROR_HANDLER_STATIC(CAsyncSocket_Class,"Shutdown - Deletion") } //Wait for clean up Sleep(1000); //Delete the thread manager if (m_pThreadManager) { delete m_pThreadManager; m_pThreadManager=NULL; } //Remove the handlers RemoveHandlers(); //Delete the CS delete m_pCSection; m_pCSection=NULL; } ERROR_HANDLER_STATIC(CAsyncSocket_Class,"Shutdown")
![]() |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |