README ¶ coroutine-tool 利用GO语言的原生协程并发处理任务 安装 go get gitee.com/adam-qiang/coroutine-tool@latest Demo package main import ( "gitee.com/adam-qiang/coroutine-tool/pool" "gitee.com/adam-qiang/coroutine-tool/task" "time" ) func main() { //创建一个任务 task1 := task.CreateTask(func() error { time.Sleep(time.Second * 1) return nil }) task2 := task.CreateTask(func() error { time.Sleep(time.Second * 10) return nil }) task3 := task.CreateTask(func() error { return nil }) //创建一个协程池 createPool := pool.CreatePool(4) //向协程池中放入任务 go func() { for i := 0; i < 50; i++ { createPool.EntryChannel <- task1 createPool.EntryChannel <- task2 createPool.EntryChannel <- task3 } }() //执行线程池 createPool.Run(3*50, true, "") } Expand ▾ Collapse ▴ Directories ¶ Show internal Expand all Path Synopsis pool progress_bar task Click to show internal directories. Click to hide internal directories.