embedded the mutex into the games global (one fewer global)

This commit is contained in:
sm
2013-09-05 18:14:41 -07:00
parent c6b480fa1e
commit 1ca4679b04
3 changed files with 20 additions and 15 deletions
+3 -3
View File
@@ -47,9 +47,9 @@ func (g *game) run() {
select {
case <-g.kill:
log.Printf("game %s: received kill signal, dying gracefully", g.id)
gameLock.Lock()
delete(games, g.id)
gameLock.Unlock()
games.Lock()
delete(games.m, g.id)
games.Unlock()
return
case p := <-g.register:
g.players[p] = true