forked from External/ergo
refactor channel registration
This commit is contained in:
parent
29db70fa7b
commit
63029e2ff5
21 changed files with 420 additions and 226 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue