1 Star 0 Fork 0

G_night / go-agopool

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
README.md 370 Bytes
Copy Edit Web IDE Raw Blame History
G_night authored 2021-06-13 17:59 . update README.md.

go-agopool

介绍

Goroutine 协程池实现

控制协程数目

分为阻塞式 和 非阻塞模式

func demo() {
	pool := agopool.NewPool()
	var sum int64 = 0
	add := func(v ...interface{}) {
		atomic.AddInt64(&sum, 1)
	}
	for i := 1; i < 1000000; i++ {
		pool.Put(add, nil, nil)
	}
	pool.Close()
	fmt.Println("demo = ", sum)
}

Comment ( 0 )

Sign in for post a comment

1
https://gitee.com/g_night/go-agopool.git
git@gitee.com:g_night/go-agopool.git
g_night
go-agopool
go-agopool
master

Search

105716 1d94204e 1850385 105716 2d26be5c 1850385