remove some comments

This commit is contained in:
andy pan 2018-05-24 19:30:18 +08:00
parent ab6390f6d0
commit 07f98b4ac6
3 changed files with 3 additions and 21 deletions

View File

@ -126,6 +126,8 @@ func (p *Pool) getWorker() *Worker {
if n < 0 {
if p.running >= p.capacity {
waiting = true
} else {
p.running++
}
} else {
w = workers[n]

View File

@ -40,7 +40,7 @@ type Worker struct {
// run will start a goroutine to repeat the process
// that perform the function calls.
func (w *Worker) run() {
atomic.AddInt32(&w.pool.running, 1)
//atomic.AddInt32(&w.pool.running, 1)
go func() {
for f := range w.task {
if f == nil || len(w.pool.release) > 0 {

View File

@ -53,26 +53,6 @@ func (w *WorkerWithFunc) run() {
}()
}
//func (w *WorkerWithFunc) run() {
// atomic.AddInt32(&w.pool.running, 1)
// go func() {
// for {
// select {
// case args := <-w.args:
// if args == nil {
// atomic.AddInt32(&w.pool.running, -1)
// return
// }
// w.pool.poolFunc(args)
// w.pool.putWorker(w)
// case <-w.pool.release:
// atomic.AddInt32(&w.pool.running, -1)
// return
// }
// }
// }()
//}
// stop this worker.
func (w *WorkerWithFunc) stop() {
w.args <- nil