github.com/hinshun/containerd@v0.2.7/supervisor/task.go (about) 1 package supervisor 2 3 import ( 4 "sync" 5 6 "github.com/docker/containerd/runtime" 7 ) 8 9 // StartResponse is the response containing a started container 10 type StartResponse struct { 11 ExecPid int 12 Container runtime.Container 13 } 14 15 // Task executes an action returning an error chan with either nil or 16 // the error from executing the task 17 type Task interface { 18 // ErrorCh returns a channel used to report and error from an async task 19 ErrorCh() chan error 20 } 21 22 type baseTask struct { 23 errCh chan error 24 mu sync.Mutex 25 } 26 27 func (t *baseTask) ErrorCh() chan error { 28 t.mu.Lock() 29 defer t.mu.Unlock() 30 if t.errCh == nil { 31 t.errCh = make(chan error, 1) 32 } 33 return t.errCh 34 }