Skip to content

Instantly share code, notes, and snippets.

@vincent6767
Created August 26, 2018 08:36
Show Gist options
  • Save vincent6767/f106803aac9acdea4473e76673636951 to your computer and use it in GitHub Desktop.
Save vincent6767/f106803aac9acdea4473e76673636951 to your computer and use it in GitHub Desktop.
Channel: Passing data to another Goroutine example
type MatchMaker {}
func (m *MatchMaker) CreateMatch(game *Game, party *Party) bool {
var serverStatusChan chan bool
gameSessionStatusChan := m.RequestGameSession(game, party) // gameSessionStatusChan returns a channel for signaling the status request.
fmt.Println(“Trying to request game session . . .”)
return <- serverStatusChan // It returns whatever the result asynchronous result operation
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment