Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ivpusic/grpool
Lightweight Goroutine pool
https://github.com/ivpusic/grpool
golang goroutine pool workers
Last synced: about 1 month ago
JSON representation
Lightweight Goroutine pool
- Host: GitHub
- URL: https://github.com/ivpusic/grpool
- Owner: ivpusic
- License: mit
- Created: 2015-07-22T00:15:04.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-01-27T23:07:22.000Z (over 5 years ago)
- Last Synced: 2024-04-14T19:16:33.490Z (about 2 months ago)
- Topics: golang, goroutine, pool, workers
- Language: Go
- Homepage: https://godoc.org/github.com/ivpusic/grpool
- Size: 19.5 KB
- Stars: 740
- Watchers: 31
- Forks: 101
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-go - grpool - Lightweight Goroutine pool. (Goroutines / Search and Analytic Databases)
- awesome-go - grpool - Lightweight Goroutine pool. (Goroutines / Search and Analytic Databases)
- awesome-go-extra - grpool - 07-22T00:15:04Z|2019-01-27T23:07:22Z| (Goroutines / Advanced Console UIs)
- awesome-go-cn - grpool
- awesome-go - grpool - Lightweight Goroutine pool. (Goroutines / Search and Analytic Databases)
- awesome-go - grpool - Lightweight Goroutine pool. (Goroutines / Advanced Console UIs)
- fucking-awesome-go - :octocat: grpool - Lightweight Goroutine pool. :star: 108 :fork_and_knife: 7 (Goroutines / Advanced Console UIs)
- awesome-go-projects - grpool - Lightweight Goroutine pool. (Goroutines / Standard CLI)
- awesome-go - grpool - Lightweight Goroutine pool. (Goroutines / Advanced Console UIs)
- awesome-go - grpool - Lightweight Goroutine pool. (Goroutines / Search and Analytic Databases)
- awesome-go - grpool - | - | - | (Goroutines / Advanced Console UIs)
- awesome-go - grpool - Lightweight Goroutine pool. (Goroutines / Advanced Console UIs)
- awesome-go-with-framework - grpool - Lightweight Goroutine pool. (Goroutines / Advanced Console UIs)
- awesome-go - grpool - Lightweight Goroutine pool. (Goroutines / Search and Analytic Databases)
- awesome-go-cn - grpool
- awesome-go-stars - grpool(stars: 739) - Lightweight Goroutine pool. (Goroutines / Search and Analytic Databases)
- awesome-go - grpool - Lightweight Goroutine pool. (Goroutines / Advanced Console UIs)
- awesome-go - grpool - 轻量级协程池. (<span id="协程-Coroutines">协程 Coroutines</span> / <span id="高级控制台用户界面-advanced-console-uis">高级控制台用户界面 Advanced Console UIs</span>)
- awesome-go. - grpool - Lightweight Goroutine pool. (Goroutines / Advanced Console UIs)
- awesome-go-cn - grpool - 轻量级 Go 语言协程池 (协程 / 高级控制台界面)
- awesome-go-with-stars - grpool - Lightweight Goroutine pool. (Goroutines / Search and Analytic Databases)
- awesome-go - grpool - Lightweight Goroutine pool. (Goroutines / Advanced Console UIs)
- repo-1316-awesome-go-cn - grpool
- repo-1211-awesome-go-cn - grpool
- awesome-Char - grpool - Lightweight Goroutine pool. (Goroutines / Advanced Console UIs)
- awesome-reader - grpool - Lightweight Goroutine pool. (Goroutines / Advanced Console UIs)
- awesome-go - grpool - Lightweight Goroutine pool. (Goroutines / Advanced Console UIs)
- Go-awesome - grpool - Lightweight Goroutine pool. (Goroutines / Search and Analytic Databases)
- go-awesome-cn-star - grpool
- awesome-go-cn - grpool
- awesome-go - grpool - Lightweight Goroutine pool. (Goroutines / Advanced Console UIs)
- awesome-go-cn - grpool
- awesome-go-zh - grpool
- awesome-go-handwritten - grpool - Lightweight Goroutine pool. (Goroutines / Advanced Console UIs)
- awesome-go - grpool - 輕量級 Go 語言協程池 (協程 / 高級控制台界面)
- awesome-go2 - grpool - Lightweight Goroutine pool. (Goroutines / Advanced Console UIs)
- awesome-go - grpool - Lightweight Goroutine pool. (Goroutines / Advanced Console UIs)
- awesome-go - grpool - Lightweight Goroutine pool. - :arrow_down:6 - :star:123 (Goroutines / Advanced Console UIs)
- awesome-go - grpool - Lightweight Goroutine pool. (Goroutines / Search and Analytic Databases)
- awesome-go - grpool - Lightweight Goroutine pool. (Goroutines / Advanced Console UIs)
- awesome-go - grpool - Lightweight Goroutine pool. (Goroutines / Advanced Console UIs)
- awesome-go-cn - grpool
- awesome-go - grpool - Lightweight Goroutine pool. (Goroutines / Search and Analytic Databases)
- awesome-go - grpool - Lightweight Goroutine pool. (Goroutines / Search and Analytic Databases)
- awesome-go - grpool - Lightweight Goroutine pool - ★ 428 (Goroutines)
README
# grpool
[![Build Status](https://travis-ci.org/ivpusic/grpool.svg?branch=master)](https://travis-ci.org/ivpusic/grpool)Lightweight Goroutine pool
Clients can submit jobs. Dispatcher takes job, and sends it to first available worker.
When worker is done with processing job, will be returned back to worker pool.Number of workers and Job queue size is configurable.
## Docs
https://godoc.org/github.com/ivpusic/grpool## Installation
```
go get github.com/ivpusic/grpool
```## Simple example
```Go
package mainimport (
"fmt"
"runtime"
"time""github.com/ivpusic/grpool"
)func main() {
// number of workers, and size of job queue
pool := grpool.NewPool(100, 50)// release resources used by pool
defer pool.Release()// submit one or more jobs to pool
for i := 0; i < 10; i++ {
count := ipool.JobQueue <- func() {
fmt.Printf("I am worker! Number %d\n", count)
}
}// dummy wait until jobs are finished
time.Sleep(1 * time.Second)
}
```## Example with waiting jobs to finish
```Go
package mainimport (
"fmt"
"runtime""github.com/ivpusic/grpool"
)func main() {
// number of workers, and size of job queue
pool := grpool.NewPool(100, 50)
defer pool.Release()// how many jobs we should wait
pool.WaitCount(10)// submit one or more jobs to pool
for i := 0; i < 10; i++ {
count := ipool.JobQueue <- func() {
// say that job is done, so we can know how many jobs are finished
defer pool.JobDone()fmt.Printf("hello %d\n", count)
}
}// wait until we call JobDone for all jobs
pool.WaitAll()
}
```## License
*MIT*