MCPcopy
hub / github.com/valyala/fasthttp / Start

Method Start

workerpool.go:49–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47}
48
49func (wp *workerPool) Start() {
50 if wp.stopCh != nil {
51 return
52 }
53 wp.stopCh = make(chan struct{})
54 stopCh := wp.stopCh
55 wp.workerChanPool.New = func() any {
56 return &workerChan{
57 ch: make(chan net.Conn, workerChanCap),
58 }
59 }
60 go func() {
61 var scratch []*workerChan
62 for {
63 wp.clean(&scratch)
64 select {
65 case <-stopCh:
66 return
67 default:
68 time.Sleep(wp.getMaxIdleWorkerDuration())
69 }
70 }
71 }()
72}
73
74func (wp *workerPool) Stop() {
75 if wp.stopCh == nil {

Callers 6

ServeMethod · 0.95
testWorkerPoolStartStopFunction · 0.95
doCommandMethod · 0.80
noopChildProducerFunction · 0.80

Calls 2

cleanMethod · 0.95

Tested by 4

testWorkerPoolStartStopFunction · 0.76
noopChildProducerFunction · 0.64