WithReaperStop sets a channel that, when closed, stops the reaper goroutine. Callers that invoke ForkReap more than once in the same process (e.g. tests) should use this to prevent goroutine accumulation.
(ch chan struct{})
| 48 | // same process (e.g. tests) should use this to prevent goroutine |
| 49 | // accumulation. |
| 50 | func WithReaperStop(ch chan struct{}) Option { |
| 51 | return func(o *options) { |
| 52 | o.ReaperStop = ch |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // WithReaperStopped sets a channel that is closed after the |
| 57 | // reaper goroutine has fully exited. |