summaryrefslogtreecommitdiff
path: root/philo.go
diff options
context:
space:
mode:
Diffstat (limited to 'philo.go')
-rw-r--r--philo.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/philo.go b/philo.go
index d5bc02a..930b23f 100644
--- a/philo.go
+++ b/philo.go
@@ -28,13 +28,13 @@ func (p Philo) Print(s string) {
fmt.Printf("%10s %s\n", p.Name, s)
}
-func (p *Philo) Arrive() stateFn {
+func (p Philo) Arrive() stateFn {
p.Print("arrives")
return p.Hungry
}
-func (p *Philo) Hungry() stateFn {
+func (p Philo) Hungry() stateFn {
p.Print("is hungry")
p.Left.Grab()
@@ -46,7 +46,7 @@ func (p *Philo) Hungry() stateFn {
return p.Starve
}
-func (p *Philo) Starve() stateFn {
+func (p Philo) Starve() stateFn {
p.Print("is starving")
p.Delay()
@@ -67,14 +67,14 @@ func (p *Philo) Eat() stateFn {
return p.Think
}
-func (p *Philo) Think() stateFn {
+func (p Philo) Think() stateFn {
p.Print("is thinking")
p.Delay()
return p.Hungry
}
-func (p *Philo) Leave() stateFn {
+func (p Philo) Leave() stateFn {
p.Print("leaves")
return nil
@@ -82,7 +82,7 @@ func (p *Philo) Leave() stateFn {
type stateFn func() stateFn
-func (p *Philo) Dine() {
+func (p Philo) Dine() {
for state := p.Arrive; state != nil; {
state = state()
}