1
0
Fork 0
forked from External/ergo

refactor channel registration

This commit is contained in:
Shivaram Lingamneni 2019-03-11 19:24:45 -04:00
parent 29db70fa7b
commit 63029e2ff5
21 changed files with 420 additions and 226 deletions

View file

@ -32,14 +32,13 @@ type ServerSemaphores struct {
ClientDestroy Semaphore
}
// NewServerSemaphores creates a new ServerSemaphores.
func NewServerSemaphores() (result *ServerSemaphores) {
// Initialize initializes a set of server semaphores.
func (serversem *ServerSemaphores) Initialize() {
capacity := runtime.NumCPU()
if capacity > MaxServerSemaphoreCapacity {
capacity = MaxServerSemaphoreCapacity
}
result = new(ServerSemaphores)
result.ClientDestroy.Initialize(capacity)
serversem.ClientDestroy.Initialize(capacity)
return
}