func (g *Gate) Enter() bool {
	if g == nil {
		return false
	}
	for {
		v := atomic.LoadUint32(&g.userCount)
		if v&gateClosed != 0 {
			return false
		}
		if atomic.CompareAndSwapUint32(&g.userCount, v, v+1) {
			return true
		}
	}
}
Enter tries to enter the gate. It will succeed if it hasn't been closed yet,
in which case the caller must eventually call Leave().

This function is thread-safe.
package gate
import (
	"sync/atomic"
)
const (
	gateClosed = 0x80000000
)
type Gate struct {
	userCount uint32
	done      chan struct{}
}