From 5ba30fd628c50f65a54509bbe47ca6dc1f296958 Mon Sep 17 00:00:00 2001 From: fupan Date: Wed, 16 Jan 2019 12:17:43 +0800 Subject: [PATCH] shimv2: multi wait support for wait service Support multi wait on one container/exec process. Fixes: #1131 Signed-off-by: fupan --- containerd-shim-v2/service.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/containerd-shim-v2/service.go b/containerd-shim-v2/service.go index 32dcf0cc1..8a36984b4 100644 --- a/containerd-shim-v2/service.go +++ b/containerd-shim-v2/service.go @@ -728,12 +728,20 @@ func (s *service) Wait(ctx context.Context, r *taskAPI.WaitRequest) (*taskAPI.Wa //wait for container if r.ExecID == "" { ret = <-c.exitCh + + // refill the exitCh with the container process's exit code in case + // there were other waits on this process. + c.exitCh <- ret } else { //wait for exec execs, err := c.getExec(r.ExecID) if err != nil { return nil, err } ret = <-execs.exitCh + + // refill the exitCh with the exec process's exit code in case + // there were other waits on this process. + execs.exitCh <- ret } return &taskAPI.WaitResponse{