Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 1.05 KB

README.md

File metadata and controls

43 lines (31 loc) · 1.05 KB

goworkers

GitHub Workflow Status codecov golangci GoDoc Go Report Card

goworkers is a simple but effecient dynamic workers pool

Types

type Pool

type Pool struct { ... }

Pool is a workers pool

Examples

ch := make(chan int)

pool := Init(func() {
    i := <-ch
    fmt.Println(i * i)
})

pool.Add(1)
ch <- 2
ch <- 3
wait := pool.Stop()
ch <- 4
<-wait

Output:

4
9
16