forked from mirror/ants
remove some comments
This commit is contained in:
parent
ab6390f6d0
commit
07f98b4ac6
2
pool.go
2
pool.go
|
@ -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]
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue