Skip to content
forked from dean2020/hackpool

北半球最优雅的go协程库,轻轻松松控制协程数,hack工具编写必备类库

Notifications You must be signed in to change notification settings

Greyh4t/hackpool

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HackPool

北半球最优雅的协程库

Example

package main

import (
	"fmt"
	"github.com/greyh4t/hackpool"
)

func main() {

	numGoroutine := 2
	taskCount := 100

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

	go func() {

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

		// push任务结束后必须关闭, 否则死锁
		hp.CloseQueue()
	}()

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

Installation

go get github.com/greyh4t/hackpool

License

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

About

北半球最优雅的go协程库,轻轻松松控制协程数,hack工具编写必备类库

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%