goinaction / code

Source Code for Go In Action examples
4.12k stars 2.36k forks source link

Issues on code/chapter/patterns/runner/runner.go #27

Open sword2ya opened 6 years ago

sword2ya commented 6 years ago

First , take a look at my version

it solved two problems

  1. when timeout , the task will continue until all finished. but in most cases, we want tasks stop immediately after timeout
  2. the interrupt signal won't stop when timeout or all task finished.
MarcusMogg commented 4 years ago

Maybe you should delete line 69-72 . This part will compete with line 98-99 . If main goroutine catch ErrTimeout, it will same as origin program, still have the problem 1. In another case, line 69-72 is useless.