format the some comments

This commit is contained in:
andy pan 2018-05-21 10:37:03 +08:00
parent 0244b2356f
commit 4c08436194
2 changed files with 9 additions and 8 deletions

13
pool.go
View File

@ -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
}

View File

@ -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
}