diff --git a/pool.go b/pool.go index ac575b8..77ec952 100644 --- a/pool.go +++ b/pool.go @@ -52,7 +52,10 @@ type Pool struct { // lock for synchronous operation. lock sync.Mutex + + // cond for waiting idle worker cond *sync.Cond + once sync.Once } diff --git a/pool_func.go b/pool_func.go index 074710e..fc3c73f 100644 --- a/pool_func.go +++ b/pool_func.go @@ -50,7 +50,10 @@ type PoolWithFunc struct { // lock for synchronous operation. lock sync.Mutex + + // cond for waiting idle worker cond *sync.Cond + // pf is the function for processing tasks. poolFunc pf