code: func (g *Gate) Leave() {
  	for {
  		v := atomic.LoadUint32(&g.userCount)
  		if v&^gateClosed == 0 {
  			panic("leaving a gate with zero usage count")
  		}
  
  		if atomic.CompareAndSwapUint32(&g.userCount, v, v-1) {
  			if v == gateClosed+1 {
  				close(g.done)
  			}
  			return
  		}
  	}
  }
docs: // Leave leaves the gate. This must only be called after a successful call to
  // Enter(). If the gate has been closed and this is the last one inside the
  // gate, it will notify the closer that the gate is done.
  //
  // This function is thread-safe.