MCPcopy Create free account
hub / github.com/divan/gotrace / pool

Function pool

examples/serverworker.go:32–44  ·  view source on GitHub ↗
(ch chan int, n int)

Source from the content-addressed store, hash-verified

30}
31
32func pool(ch chan int, n int) {
33 wch := make(chan int)
34 results := make(chan int)
35 for i := 0; i < n; i++ {
36 go worker(wch, results)
37 time.Sleep(1 * time.Millisecond)
38 }
39 go parse(results)
40 for {
41 val := <-ch
42 wch <- val
43 }
44}
45
46func server(l net.Listener, ch chan int) {
47 for {

Callers 1

mainFunction · 0.70

Calls 3

makeFunction · 0.85
parseFunction · 0.85
workerFunction · 0.70

Tested by

no test coverage detected