Skip to content

Instantly share code, notes, and snippets.

@ryanivandsouza
Created December 2, 2020 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanivandsouza/f74de93f7c2af6802f9344f00c1bf29b to your computer and use it in GitHub Desktop.
Save ryanivandsouza/f74de93f7c2af6802f9344f00c1bf29b to your computer and use it in GitHub Desktop.
func (host *Host) acceptRequest(philosopher *Philosopher, requestID int, wg *sync.WaitGroup) {
go func() {
<-host.servingAvailable
philosopher.eat()
}()
go func() {
<-philosopher.eatingEnded
host.servingAvailable <- "serving available"
wg.Done()
}()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment