// Waits for sent SYN to be ACKed. Returns any errors.
481056
func (c *Conn) recvSynAck() (err error) {
	mu.Lock()
	defer mu.Unlock()
	c.waitAck(1)
	if c.err != nil {
		err = c.err
	}
	c.synAcked = true
	c.updateCanWrite()
	return err
}
900470
func (m *Command) Wait() error {
	// First SIGKILL causes server to shut down gracefully.
	c := make(chan os.Signal, 2)
	signal.Notify(c, os.Interrupt, syscall.SIGTERM)
	select {
	case sig := <-c:
		m.logger.Printf("received signal '%s', gracefully shutting down...\n", sig.String())

		// Second signal causes a hard shutdown.
		go func() { <-c; os.Exit(1) }()
		return errors.Wrap(m.Close(), "closing command")
	case <-m.done:
		m.logger.Printf("server closed externally")
		return nil
	}
}
395209
func (f *tokenFuture) Wait() <-chan struct{} {
	f.m.Lock()
	defer f.m.Unlock()

	c := make(chan struct{})
	if f.set {
		close(c)
		return c
	}

	f.waiting = append(f.waiting, c)
	return c
}
307550
func (w *CleanupWorker) Wait() error {
	err := w.Worker.Wait()
	w.cleanupOnce.Do(w.cleanup)
	return err
}
542222
func (c *Client) Wait() string {
	waitC := make(chan string, 1)
	var ch chan<- string = waitC

	select {
	case <-c.closing:
	case c.mounted <- ch:
	}

	select {
	case <-c.closing:
	case s := <-waitC:
		return s
	}

	return ""
}
831764
func (k *kq) Wait() (interface{}, error) {
	var (
		kevn [1]syscall.Kevent_t
		err  error
	)
	kevn[0] = syscall.Kevent_t{}
	_, err = syscall.Kevent(k.fd, nil, kevn[:], nil)

	return kevn[0], err
}
589420
func (cli *Client) waitPacket(packetc <-chan struct{}, timeout time.Duration, errTimeout error) {
	defer cli.conn.wg.Done()

	var timeoutc <-chan time.Time

	if timeout > 0 {
		timeoutc = time.After(timeout * time.Second)
	}

	select {
	case <-packetc:
	case <-timeoutc:
		// Handle the timeout error.
		cli.handleErrorAndDisconn(errTimeout)
	}
}
1202015
func (l *EventListener) Wait(ctx context.Context) (eh.Event, error) {
	select {
	case event := <-l.inbox:
		return event, nil
	case <-ctx.Done():
		return nil, ctx.Err()
	}
}
299090
func (s *Server) Wait(ctx context.Context) {
	select {
	case <-s.closeContext.Done():
	case <-ctx.Done():
	}
}
1012976
func (c *Client) Flush() {
	c.initBundler()
	c.bundler.Flush()
	c.outstanding.Wait()
}
1007433
func Wait(waitables ...Waitable) error {
	g := NewGroup()
	g.Collect(waitables...)
	return g.Wait()
}
962684
func (b *baseToken) Wait() bool {
	b.m.Lock()
	defer b.m.Unlock()
	if !b.ready {
		<-b.complete
		b.ready = true
	}
	return b.ready
}
400566
func (s *ServerRPC) Wait(c context.Context, req *types.WaitRequest) (*types.WaitResponse, error) {
	//FIXME need update if param NoHang is enabled
	code, err := s.daemon.ExitCode(req.Container, req.ProcessId)
	if err != nil {
		return nil, err
	}

	return &types.WaitResponse{
		ExitCode: int32(code),
	}, nil
}
851636
func (rs *retryingSink) wait(backoff time.Duration) {
	rs.mu.Unlock()
	defer rs.mu.Lock()

	// backoff here
	time.Sleep(backoff)
}
1265553
func (r *RateLimiter) Wait() {
	for {
		ok, remaining := r.Try()
		if ok {
			break
		}
		time.Sleep(remaining)
	}
}
1018738
func (rs *Result) Wait() {
	rs.consolidator.Record(rs.query)
	rs.executing.RLock()
}
1211821
func (f *tsFuture) Wait() (uint64, error) {
	now := time.Now()
	physical, logical, err := f.TSFuture.Wait()
	metrics.TSFutureWaitDuration.Observe(time.Since(now).Seconds())
	if err != nil {
		return 0, errors.Trace(err)
	}
	ts := oracle.ComposeTS(physical, logical)
	f.o.setLastTS(ts)
	return ts, nil
}