Fixed multithreading issues when creating/joining a game. Sessions are now queued.
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
#include <gui/guiinterface.h>
|
||||
#include <gamedata.h>
|
||||
|
||||
#include <deque>
|
||||
|
||||
#define GAME_THREAD_TERMINATE_TIMEOUT 200
|
||||
|
||||
|
||||
@@ -48,7 +50,7 @@ public:
|
||||
u_int32_t GetId() const;
|
||||
const std::string &GetName() const;
|
||||
|
||||
bool AddSession(SessionWrapper session);
|
||||
void AddSession(SessionWrapper session);
|
||||
|
||||
ServerCallback &GetCallback();
|
||||
GameState GetCurRound() const;
|
||||
@@ -60,6 +62,8 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
typedef std::deque<SessionWrapper> SessionQueue;
|
||||
|
||||
// Main function of the thread.
|
||||
virtual void Main();
|
||||
|
||||
@@ -101,6 +105,9 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
SessionQueue m_sessionQueue;
|
||||
mutable boost::mutex m_sessionQueueMutex;
|
||||
|
||||
SessionManager m_sessionManager;
|
||||
PlayerDataList m_computerPlayers;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user