@@ -81,7 +81,7 @@ func main() {
8181
8282 for result := range p.Results () {
8383
84- err , ok := result.(error )
84+ err , ok := result.(*pool. ErrRecovery )
8585 if ok {
8686 // there was some sort of panic that
8787 // was recovered, in this scenario
@@ -139,8 +139,8 @@ func main() {
139139
140140 for result := range p.Results () {
141141 switch result.(type ) {
142- case error :
143- err := result.(error )
142+ case *pool. ErrRecovery :
143+ err := result.(*pool. ErrRecovery )
144144 // do what you want with error or cancel the pool here p.Cancel()
145145 fmt.Println (err)
146146 default :
@@ -158,11 +158,10 @@ Benchmarks
158158``` go
159159$ go test -cpu=4 -bench=. -benchmem=true
160160PASS
161- BenchmarkSmallRun-4 1 3009120497 ns/op 3360 B /op 65 allocs/op
162- BenchmarkSmallCancel-4 1 2003173598 ns/op 3696 B /op 81 allocs/op
163- BenchmarkLargeCancel-4 1 2001222531 ns/op 106784 B /op 3028 allocs/op
164- BenchmarkOverconsumeLargeRun-4 1 4004509778 ns/op 36528 B /op 661 allocs/op
165- ok github.com /joeybloggs/pool 14. 230s
161+ BenchmarkSmallRun-4 1 3000201819 ns/op 2272 B /op 58 allocs/op
162+ BenchmarkSmallCancel-4 1 2002207036 ns/op 2928 B /op 79 allocs/op
163+ BenchmarkLargeCancel-4 1 2000774880 ns/op 106656 B /op 3026 allocs/op
164+ BenchmarkOverconsumeLargeRun-4 1 4003364358 ns/op 29872 B /op 557 allocs/op
166165```
167166To put these benchmarks in perspective:
168167
0 commit comments