Пример #1
0
// newExecWorker is a constructor for execWorker.
func newExecWorker(probeCmd, probePath string, execPeriod time.Duration, exec utilexec.Interface, clock clock.Clock, readyCh chan<- struct{}) *execWorker {
	return &execWorker{
		// Initializing the result with a timestamp here allows us to
		// wait maxLatency for the worker goroutine to start, and for each
		// iteration of the worker to complete.
		exec:      exec,
		clock:     clock,
		result:    execResult{[]byte{}, nil, clock.Now()},
		period:    execPeriod,
		probeCmd:  probeCmd,
		probePath: probePath,
		stopCh:    make(chan struct{}),
		readyCh:   readyCh,
	}
}