Skip to content

lrsec/gpool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

goroutine_pool

goroutine_pool is a dynamic pool of goroutines followed the pipeline pattern.

Purpose

  • Reuse goroutines
  • Reduce overheads of creating huge number of short-live goroutines
  • Reduce burden of GC
  • Control total number of goroutines

Usage

get the package

go get -u github.com/lrsec/goroutine_pool

Get the pool

import "github.com/lrsec/goroutine_pool"

inputChannel chan interface{}
outputChannel chan interface{}

pool, err := goroutine_pool.NewPool(100, 10000, 150, 60 * time.Second, 5 * time.Second, inputChannel, outputChannel, "test_pool", func (message interface{}, channel chan interface{}) error {
    outputChannel<-message
    return nil
})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages