Skip to content

dean2021/hackpool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HackPool

北半球最优雅的协程池

Example

package main

import (
	"fmt"
	"github.com/poc-db/hackpool"
)

func main() {

	concurrency := 2   // 并发数
	taskCount := 100   

	hp := hackpool.New(concurrency, func(i interface{}) {
		fmt.Println(i.(int))
	})

	go func() {

		for i := 0; i < taskCount; i++ {
			hp.Push(i)
		}

		// 必须关闭,不然阻塞死锁
		hp.Close()
	}()

	// 跑起来! 伙计
	hp.Run()
}

Installation

go get github.com/poc-db/hackpool

License

This project is copyleft of CSOIO and released under the GPL 3 license.

About

优雅的go协程库,轻松控制并发数

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages