embedded the mutex into the games global (one fewer global)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user