From b7a9cd591600086ee8cabddfad449bd48c091841 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 26 Feb 2017 00:03:11 +0100 Subject: Cleanup --- main.go | 8 ++++---- philo.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 23275d1..e2dd220 100644 --- a/main.go +++ b/main.go @@ -14,8 +14,8 @@ func init() { func main() { names := Names{"Aristotle", "Kant", "Spinoza", "Marx", "Russell"} flag.Var(&names, "names", "philospher names") - bites := flag.Int("bites", 3, "number of rounds") - delay := flag.Duration("max delay", 3*time.Second, "delay") + rounds := flag.Int("rounds", 3, "number of rounds") + maxDelay := flag.Duration("max delay", 3*time.Second, "delay") timeOut := flag.Duration("timeout", time.Second, "delay") flag.Parse() @@ -28,8 +28,8 @@ func main() { Name: name, Left: forks[i], Right: forks[(i+1)%len(names)], - Bites: *bites, - MaxDelay: *delay, + Rounds: *rounds, + MaxDelay: *maxDelay, TimeOut: *timeOut, } go func() { diff --git a/philo.go b/philo.go index 056e7aa..6945def 100644 --- a/philo.go +++ b/philo.go @@ -10,7 +10,7 @@ type Philo struct { Name string Left Fork Right Fork - Bites int + Rounds int MaxDelay time.Duration TimeOut time.Duration } @@ -56,7 +56,7 @@ func (p *Philo) Eat() stateFn { p.Left.Put() p.Right.Put() - if p.Bites--; p.Bites <= 0 { + if p.Rounds--; p.Rounds <= 0 { return p.Leave } -- cgit v1.2.3