don't need the top-level waitgroup
This commit is contained in:
parent
c2a087abf7
commit
137cfd379b
16
12/main.go
16
12/main.go
@ -108,13 +108,7 @@ func partOne() {
|
|||||||
rooms[p[1]] = b
|
rooms[p[1]] = b
|
||||||
}
|
}
|
||||||
successes := make(chan bool, 10000)
|
successes := make(chan bool, 10000)
|
||||||
var wg sync.WaitGroup
|
descend(rooms, "start", []string{}, successes, false)
|
||||||
wg.Add(1)
|
|
||||||
go func() {
|
|
||||||
defer wg.Done()
|
|
||||||
descend(rooms, "start", []string{}, successes, false)
|
|
||||||
}()
|
|
||||||
wg.Wait()
|
|
||||||
fmt.Printf("%+v\n", len(successes))
|
fmt.Printf("%+v\n", len(successes))
|
||||||
}
|
}
|
||||||
func partTwo() {
|
func partTwo() {
|
||||||
@ -140,12 +134,6 @@ func partTwo() {
|
|||||||
rooms[p[1]] = b
|
rooms[p[1]] = b
|
||||||
}
|
}
|
||||||
successes := make(chan bool, 200000)
|
successes := make(chan bool, 200000)
|
||||||
var wg sync.WaitGroup
|
descend(rooms, "start", []string{}, successes, true)
|
||||||
wg.Add(1)
|
|
||||||
go func() {
|
|
||||||
defer wg.Done()
|
|
||||||
descend(rooms, "start", []string{}, successes, true)
|
|
||||||
}()
|
|
||||||
wg.Wait()
|
|
||||||
fmt.Printf("%+v\n", len(successes))
|
fmt.Printf("%+v\n", len(successes))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user