Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 332 Bytes

README.md

File metadata and controls

23 lines (17 loc) · 332 Bytes

goroutine-pool

A simple implementation of goroutine pool

case:

pool := NewPool(3)

task := NewTask(func() error {
    fmt.Println("time now--->", time.Now().Format("2006-01-02 15:04:05"))
    return nil
})

go func() {
    for {
        time.Sleep(time.Second)
        pool.EntranceChan <- task
    }
}()

pool.run()