//主线程 void* NetEngine::Main(void*) { while ( !m_stop ) { if ( m_sigStop.Wait( 10000 ) ) break; HeartMonitor(); ReConnectAll(); } return NULL; }
//主线程 void* STNetEngine::Main(void*) { time_t lastConnect = time(NULL); time_t curTime = time(NULL); while ( !m_stop ) { #ifdef WIN32 if ( !WINIO( 10000 ) ) break; #else if ( !LinuxIO( 10000 ) ) break; #endif curTime = time(NULL); if ( 10000 <= curTime - lastConnect ) continue; lastConnect = curTime; HeartMonitor(); ReConnectAll(); } return NULL; }