func (runner *Runner) StartWorker(id string, startFunc func() (Worker, error)) error {
	// Note: we need the reply channel so that when StartWorker
	// returns, we're guaranteed that the worker is installed
	// when we return, so Worker will see it if called
	// immediately afterwards.
	reply := make(chan error)
	select {
	case runner.startc <- startReq{id, startFunc, reply}:
		// We're certain to get a reply because the startc channel is synchronous
		// so if we succeed in sending on it, we know that the run goroutine has entered
		// the startc arm of the select, and that calls startWorker (which never blocks)
		// and then immediately sends any error to the reply channel.
		return <-reply
	case <-runner.tomb.Dead():
	}
	return ErrDead
}
// StartWorker starts a worker running associated with the given id.
// The startFunc function will be called to create the worker;
// when the worker exits, an AlreadyExists error will be returned.
//
// StartWorker returns ErrDead if the runner is not running.
StartWorker starts a worker running associated with the given id.
The startFunc function will be called to create the worker;
when the worker exits, an AlreadyExists error will be returned.

StartWorker returns ErrDead if the runner is not running.
// StartWorker starts a worker running associated with the given id . // The startFunc function will be called to create the worker ; // when the worker exits an AlreadyExists error will be returned . // // StartWorker returns ErrDead if the runner is not running .
func (runner *Runner) StartWorker(id string, startFunc func() (Worker, error)) error {
	reply := make(chan error)
	select {
	case runner.startc <- startReq{id, startFunc, reply}:
		return <-reply
	case <-runner.tomb.Dead():
	}
	return ErrDead
}
func ( runner * Runner ) StartWorker ( id string , startFunc func ( ) ( Worker , error ) ) error { reply := make ( chan error ) select { case runner . startc <- startReq { id , startFunc , reply } : return <- reply case <- runner . tomb . Dead ( ) : } return ErrDead }
StartWorker starts a worker running associated with the given id.
StartWorker starts a worker running associated with the given id .
// Note: we need the reply channel so that when StartWorker // returns, we're guaranteed that the worker is installed // when we return, so Worker will see it if called // immediately afterwards. // We're certain to get a reply because the startc channel is synchronous // so if we succeed in sending on it, we know that the run goroutine has entered // the startc arm of the select, and that calls startWorker (which never blocks) // and then immediately sends any error to the reply channel.