summaryrefslogtreecommitdiff
path: root/static_pool.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-04-15 20:16:46 +0300
committerValery Piashchynski <[email protected]>2020-04-15 20:16:46 +0300
commit6625950ac6f382f6a46bc52bf17908ef13bdc429 (patch)
tree486bdfd86f8f1c0a269cd9dfdf46c1f73943524e /static_pool.go
parentcc9c74665a9cabcfb006ab6b7a9beafb95ff7316 (diff)
Add user to worker
Diffstat (limited to 'static_pool.go')
-rw-r--r--static_pool.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/static_pool.go b/static_pool.go
index 2186227b..ac9c2529 100644
--- a/static_pool.go
+++ b/static_pool.go
@@ -26,7 +26,7 @@ type StaticPool struct {
factory Factory
// active task executions
- tmu sync.Mutex
+ tmu *sync.Mutex
tasks sync.WaitGroup
// workers circular allocation buf
@@ -36,13 +36,13 @@ type StaticPool struct {
numDead int64
// protects state of worker list, does not affect allocation
- muw sync.RWMutex
+ muw *sync.RWMutex
// all registered workers
workers []*Worker
// invalid declares set of workers to be removed from the pool.
- remove sync.Map
+ remove *sync.Map
// pool is being destroyed
inDestroy int32
@@ -66,6 +66,9 @@ func NewPool(cmd func() *exec.Cmd, factory Factory, cfg Config) (*StaticPool, er
workers: make([]*Worker, 0, cfg.NumWorkers),
free: make(chan *Worker, cfg.NumWorkers),
destroy: make(chan interface{}),
+ tmu: &sync.Mutex{},
+ remove: &sync.Map{},
+ muw: &sync.RWMutex{},
}
// constant number of workers simplify logic