setGameState()
and getGameState()
can be called from different threads. m_gameState
is volatile so its value/change could be visible to other threads.
Question:
Do the functions need to be synchronized
or does volatile on the variable suffice?
private volatile EGameState m_gameState;
public void setGameState(EGameState a_gameState) {
m_gameState = a_gameState;
}
public EGameState getGameState() {
return m_gameState;
}