From e538683d3f8d6b8711385c8e7fd63a1c751551d2 Mon Sep 17 00:00:00 2001 From: AndyPan Date: Sun, 30 Sep 2018 09:41:47 +0800 Subject: [PATCH] add comments --- pool.go | 3 +++ pool_func.go | 3 +++ 2 files changed, 6 insertions(+) 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