diff options
Diffstat (limited to 'static_pool.go')
-rw-r--r-- | static_pool.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/static_pool.go b/static_pool.go index b3e4f488..79166197 100644 --- a/static_pool.go +++ b/static_pool.go @@ -83,6 +83,12 @@ func (p *StaticPool) Listen(l func(event int, ctx interface{})) { defer p.mul.Unlock() p.lsn = l + + p.muw.RLock() + for _, w := range p.workers { + w.err.Listen(l) + } + p.muw.RUnlock() } // Config returns associated pool configuration. Immutable. @@ -207,6 +213,12 @@ func (p *StaticPool) createWorker() (*Worker, error) { return nil, err } + p.mul.Lock() + if p.lsn != nil { + w.err.Listen(p.lsn) + } + defer p.mul.Unlock() + p.throw(EventWorkerConstruct, w) p.muw.Lock() |