Ejemplo n.º 1
0
    void Run()
    {
        {
            CS::Threading::MutexScopedLock lock (doneMutex);
            // construct the netManager is its own thread to avoid wrong warnings of dynamic thread checking via valgrind
            netManager.AttachNew(new NetManager(thread));
            if (!netManager->Initialize(client_firstmsg, npcclient_firstmsg,
                                        timeout))
            {
                Error1 ("Network thread initialization failed!\nIs there already a server running?");
                delete netManager;
                netManager = NULL;
                initDone.NotifyAll();
                return;
            }
            initDone.NotifyAll();
        }

        /* run the network loop */
        netManager->Run();
    }