Skip to content
Concurrency limiting goroutine pool
Branch: master
Clone or download
gammazero Merge pull request #17 from kishaningithub/patch-1
Add real world examples to the README
Latest commit 0ed5e40 Jun 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
pacer Put waiting tasks into queue instead of goroutines May 11, 2018
.gitignore ignore emacs backup May 17, 2016
.travis.yml test with latest go May 21, 2019
LICENSE Initial commit May 17, 2016
README.md Add real world examples to the README Jun 8, 2019
doc.go update doc Jun 2, 2018
go.mod test with latest go May 21, 2019
go.sum test with latest go May 21, 2019
go.test.sh Add coverage test script Oct 13, 2017
workerpool.go Add module support May 15, 2019
workerpool_test.go fix spelling mistake Apr 3, 2019

README.md

workerpool

Build Status Go Report Card codecov License

Concurrency limiting goroutine pool. Limits the concurrency of task execution, not the number of tasks queued. Never blocks submitting tasks, no matter how many tasks are queued.

GoDoc

This implementation builds on ideas from the following:

Installation

To install this package, you need to setup your Go workspace. The simplest way to install the library is to run:

$ go get github.com/gammazero/workerpool

Example

package main

import (
	"fmt"
	"github.com/gammazero/workerpool"
)

func main() {
	wp := workerpool.New(2)
	requests := []string{"alpha", "beta", "gamma", "delta", "epsilon"}

	for _, r := range requests {
		r := r
		wp.Submit(func() {
			fmt.Println("Handling request:", r)
		})
	}

	wp.StopWait()
}

Real world examples

The list of open source projects using worker pool can be found here

You can’t perform that action at this time.