code: func (i *Instance) Wait(ctx context.Context, e Entry, reason string, p priority) (eh *EntryHandle) {
  	eh = &EntryHandle{
  		reason:   reason,
  		e:        e,
  		i:        i,
  		priority: p,
  		created:  time.Now(),
  	}
  	i.mu.Lock()
  	hs, ok := i.entries[eh.e]
  	if ok {
  		hs[eh] = struct{}{}
  		i.mu.Unlock()
  		expvars.Add("waits for existing entry", 1)
  		return
  	}
  	if i.noMaxEntries || len(i.entries) < i.maxEntries {
  		i.entries[eh.e] = handles{
  			eh: struct{}{},
  		}
  		i.mu.Unlock()
  		expvars.Add("waits with space in table", 1)
  		return
  	}
  	// Lock the mutex, so that a following Lock will block until it's unlocked by a wake event.
  	eh.wake.Lock()
  	i.addWaiter(eh)
  	i.mu.Unlock()
  	expvars.Add("waits that blocked", 1)
  	ctx, cancel := context.WithCancel(ctx)
  	defer cancel()
  	go func() {
  		<-ctx.Done()
  		i.mu.Lock()
  		if _, ok := i.waiters[eh]; ok {
  			i.deleteWaiter(eh)
  			eh.wake.Unlock()
  		}
  		i.mu.Unlock()
  	}()
  	// Blocks until woken by an Unlock.
  	eh.wake.Lock()
  	i.mu.Lock()
  	if _, ok := i.entries[eh.e][eh]; !ok {
  		eh = nil
  	}
  	i.mu.Unlock()
  	return
  }
docs: // Nil returns are due to context completion.