From 4c084361949c1bea9c652bae32bf7f4ac9b46f5b Mon Sep 17 00:00:00 2001 From: andy pan Date: Mon, 21 May 2018 10:37:03 +0800 Subject: [PATCH] format the some comments --- pool.go | 13 +++++++------ worker.go | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pool.go b/pool.go index c5ec6e1..704571c 100644 --- a/pool.go +++ b/pool.go @@ -36,27 +36,28 @@ type f func() // Pool accept the tasks from client,it will limit the total // of goroutines to a given number by recycling goroutines. type Pool struct { - // Capacity of the pool. + // capacity of the pool. capacity int32 - // The number of the currently running goroutines. + // running is the number of the currently running goroutines. running int32 - // Signal is used to notice pool there are available + // signal is used to notice pool there are available // workers which can be sent to work. freeSignal chan sig - // A slice that store the available workers. + // workers is a slice that store the available workers. workers []*Worker + // workerPool is a pool that saves a set of temporary objects. workerPool sync.Pool - // It is used to notice the pool to closed itself. + // release is used to notice the pool to closed itself. release chan sig lock sync.Mutex - // It is used to confirm whether this pool has been closed. + // closed is used to confirm whether this pool has been closed. closed int32 } diff --git a/worker.go b/worker.go index 5552742..d46ffa4 100644 --- a/worker.go +++ b/worker.go @@ -30,10 +30,10 @@ import ( // it will start a goroutine that accept tasks and // perform function calls. type Worker struct { - // A pool who owns this worker. + // pool who owns this worker. pool *Pool - // The job should be done. + // task is a job should be done. task chan f }