summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-02-26 00:03:11 +0100
committerDimitri Sokolyuk <demon@dim13.org>2017-02-26 00:03:11 +0100
commitb7a9cd591600086ee8cabddfad449bd48c091841 (patch)
treed9b08a3b1eaa8466f34ac5d60240aa3c4a37c5fe
parent6571642c66bfcef49a1cc18b950b09f13131dd5a (diff)
Cleanup
-rw-r--r--main.go8
-rw-r--r--philo.go4
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
}