package
0.0.0-20250225101116-3f8638f51c14
Repository: https://github.com/wangzhione/sbp.git
Documentation: pkg.go.dev

# README

goroutines

goroutines is a simple goroutine pool which aims to reuse goroutines and limit the number of goroutines.

goroutines 是一个简单的 goroutine 池,旨在复用 goroutine,并限制 goroutine 的数量

example

[optional] Step 0 : main.init add goroutines.InitPanicHandler

// register global panic handler
goroutines.InitPanicHandler(func (ctx context.Context, cover any) {
    // ctx is goroutines.Go func context, cover = recover()
}) 

Step 1 : Let's Go

o := goroutines.NewPool(8)

o.Go(ctx, func(){
    // Your business
})