コード例 #1
0
int RaptorServer::Start( std::string name )
{
	Data.Properties["name"] = name;
	
	if( IsRunning() )
	{
		Net.SendAllReconnect();
		StopAndWait();
		SDL_Delay( 200 );
	}
	
	Net.NetRate = NetRate;
	Net.UseOutThreads = UseOutThreads;
	
	if( !( Thread = SDL_CreateThread( RaptorServerThread, this ) ) )
	{
		fprintf( stderr, "SDL_CreateThread: %s\n", SDLNet_GetError() );
		return -1;
	}
	
	State = Raptor::State::CONNECTED;
	Started();
	
	return 0;
}
コード例 #2
0
ファイル: RAD_Thread.cpp プロジェクト: aclisp/large-scale
RAD_Thread::~RAD_Thread()
{
    // this is an undetached thread, it would be reset after join
    if(m_handle) {
        radlog(L_WARN|L_CONS, "[RAD_Thread] dtor called, "
               "but thread '%s' is still running, forced stop",
               m_ThreadName.c_str());
        StopAndWait(0);
    }
}
コード例 #3
0
RaptorServer::~RaptorServer()
{
	if( IsRunning() )
		StopAndWait( 5. );
	
	if( Thread )
	{
		// FIXME: This is causing crashing sometimes!
		//        Probably when SDLNet_Quit() has already been called.
		SDL_KillThread( Thread );
		Thread = NULL;
	}
}
コード例 #4
0
ファイル: Reactor.cpp プロジェクト: hdzz/EpollServer
 Reactor::~Reactor() {
     //Wait the termination of the thread
     StopAndWait();
 }