Goroutine Pool
1package test 2 3import ( 4 "fmt" 5 "runtime" 6 "testing" 7 "time" 8) 9 10type PPool struct { 11 EntryChan chan func() error 12 JobChan chan func() error 13 WorkNum int 14} 15 16func NewPPool(cap int) *PPool { 17 p := PPool{ 18 EntryChan: make(chan func() error), 19 JobChan: make(chan …