summaryrefslogtreecommitdiff
path: root/philo.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-04-02 15:41:52 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-04-02 15:41:52 +0200
commit936e13ba9225e271911bf097e9f918c80f1d361d (patch)
tree9f947e8f63a949c5f28dd1204a7c2e2b49c9d52f /philo.go
parent1a550cbf5a29f514d0db64884630f6a390871ec6 (diff)
Add report channelHEADmaster
Diffstat (limited to 'philo.go')
-rw-r--r--philo.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/philo.go b/philo.go
index 7007a7a..f14c095 100644
--- a/philo.go
+++ b/philo.go
@@ -17,6 +17,7 @@ type Philo struct {
Rounds int
MaxDelay time.Duration
TimeOut time.Duration
+ Report chan string
}
func (p Philo) Delay() {
@@ -25,7 +26,7 @@ func (p Philo) Delay() {
}
func (p Philo) Print(s string) {
- fmt.Printf("%10s %s\n", p.Name, s)
+ p.Report <- fmt.Sprintf("%10s %s", p.Name, s)
}
func (p Philo) Arrive() stateFn {