// Waits synchronously waits for the container to shutdown or terminate.
509861
func (container *container) Wait() error {
	err := container.system.Wait()
	if err == nil {
		err = container.system.ExitError()
	}
	return convertSystemError(err, container)
}
940993
func (s *BatchServiceStateManager) Wait(tenantID string) {
	s.lock.RLock()
	var wg sync.WaitGroup
	for _, queue := range s.TenantQueues[tenantID] {
		wg.Add(1)
		go func(q *ServiceStateQueue) {
			s.drainQueue(q)
			wg.Done()
		}(queue)
	}
	s.lock.RUnlock()
	wg.Wait()
}
1067845
func (cond *Cond) Wait(mutex *Mutex) error {
	ret := int(C.SDL_CondWait(cond.cptr(), mutex.cptr()))
	if ret != 0 {
		return GetError()
	}
	return nil
}
829999
func (r *remoteSubsystem) Wait() error {
	var lastErr error

	for i := 0; i < 3; i++ {
		select {
		case err := <-r.errorCh:
			if err != nil && err != io.EOF {
				r.log.Warnf("Connection problem: %v %T", trace.DebugReport(err), err)
				lastErr = err
			}
		case <-r.ctx.Done():
			lastErr = trace.ConnectionProblem(nil, "context is closing")
		}
	}

	// emit an event to the audit log with the result of execution
	r.emitAuditEvent(lastErr)

	return lastErr
}
1018738
func (rs *Result) Wait() {
	rs.consolidator.Record(rs.query)
	rs.executing.RLock()
}
971382
func (uvm *UtilityVM) Wait() error {
	err := uvm.hcsSystem.Wait()

	// outputProcessingCancel will only cancel waiting for the vsockexec
	// connection, it won't stop output processing once the connection is
	// established.
	if uvm.outputProcessingCancel != nil {
		uvm.outputProcessingCancel()
	}
	uvm.waitForOutput()

	return err
}
660313
func (facade *Facade) Wait(ctx context.Context, args params.Entities) (result params.ErrorResults) {
	result.Results = make([]params.ErrorResult, len(args.Entities))
	for i, entity := range args.Entities {
		leaseId, err := facade.tagLeaseId(entity.Tag)
		if err != nil {
			result.Results[i].Error = common.ServerError(err)
			continue
		}
		// TODO(axw) 2017-10-30 #1728594
		// We should be waiting for the leases in parallel,
		// so the waits do not affect one another.
		err = facade.singularClaimer.WaitUntilExpired(leaseId, ctx.Done())
		result.Results[i].Error = common.ServerError(err)
	}
	return result
}
545636
func (container *container) WaitTimeout(timeout time.Duration) error {
	container.waitOnce.Do(func() {
		container.waitCh = make(chan struct{})
		go func() {
			container.waitErr = container.Wait()
			close(container.waitCh)
		}()
	})
	t := time.NewTimer(timeout)
	defer t.Stop()
	select {
	case <-t.C:
		return &ContainerError{Container: container, Err: ErrTimeout, Operation: "hcsshim::ComputeSystem::Wait"}
	case <-container.waitCh:
		return container.waitErr
	}
}
1031647
func (k *KubeletExecutor) Wait(containerID string) error {
	return k.cli.WaitForTermination(containerID, 0)
}
116530
func (c *client) Wait(id int64) *Wait {
	ctx, cancel := context.WithCancel(context.Background())
	return &Wait{id, c, ctx, cancel}
}
449814
func (c *SSHClient) Wait() error {
	if !c.running {
		return fmt.Errorf("Trying to wait on stopped session")
	}

	err := c.sess.Wait()
	c.sess.Close()
	c.running = false
	c.sessOpened = false

	return err
}
117992
func (s *Service) wait() {
	c := make(chan os.Signal, 1)
	signal.Notify(c, os.Interrupt, syscall.SIGTERM, os.Kill)
	select {
	case sig := <-c:
		BootPrintln("[service] got signal:", sig)
	case <-s.stopper:
		BootPrintln("[service] app stop")
	}
	s.stop()
}
389930
func (dl *Download) Wait() (string, error) {
	// No select required here because each download will always
	// return a value once it completes. Downloads can be aborted via
	// the Abort channel provided a creation time.
	status := <-dl.Done()
	return status.Filename, errors.Trace(status.Err)
}
37496
func (s *service) Wait(ctx context.Context, r *taskAPI.WaitRequest) (*taskAPI.WaitResponse, error) {
	log.G(ctx).Debugf("Wait: %s: %s", r.ID, r.ExecID)

	var p *process
	var err error
	if p, err = s.getProcess(r.ID, r.ExecID); err != nil {
		return nil, err
	}
	pe := p.wait()
	return &taskAPI.WaitResponse{
		ExitedAt:   pe.exitedAt,
		ExitStatus: pe.exitStatus,
	}, nil
}
957059
func (m *EventHandler) Wait(d time.Duration) bool {
	select {
	case <-m.Recv:
		return true
	case <-time.After(d):
		return false
	}
}
423665
func (s *Session) Wait() error {
	var pipeErr, lastErr error
	for _, cmd := range s.cmds {
		if lastErr = cmd.Wait(); lastErr != nil {
			pipeErr = lastErr
		}
		wr, ok := cmd.Stdout.(*io.PipeWriter)
		if ok {
			wr.Close()
		}
	}
	if s.PipeFail {
		return pipeErr
	}
	return lastErr
}
657743
func (p *process) Wait(ctx context.Context) (*runtime.Exit, error) {
	response, err := p.shim.task.Wait(ctx, &task.WaitRequest{
		ID:     p.shim.ID(),
		ExecID: p.id,
	})
	if err != nil {
		return nil, errdefs.FromGRPC(err)
	}
	return &runtime.Exit{
		Timestamp: response.ExitedAt,
		Status:    response.ExitStatus,
	}, nil
}