Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matthewoestreich/puddle
Puddle is a fork of `github.com/gammazero/workerpool` and meant for learning purposes.
https://github.com/matthewoestreich/puddle
concurrency golang golang-worker-pool multithreading worker-pool
Last synced: about 2 months ago
JSON representation
Puddle is a fork of `github.com/gammazero/workerpool` and meant for learning purposes.
- Host: GitHub
- URL: https://github.com/matthewoestreich/puddle
- Owner: matthewoestreich
- License: mit
- Created: 2020-10-03T02:08:43.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-03T02:21:21.000Z (over 4 years ago)
- Last Synced: 2024-11-21T06:19:01.139Z (2 months ago)
- Topics: concurrency, golang, golang-worker-pool, multithreading, worker-pool
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# puddle
Puddle is a worker pool that was [forked from `workerpool`](https://github.com/gammazero/workerpool) and meant to help me learn channels and concurrency design.
The biggest difference is `workerpool` uses a [custom ring buffer implementation](https://github.com/gammazero/deque) while `puddle` uses the built-in `container/list` package.
---
\****not designed for production use***\*---
### Install
```
go get -u github.com/oze4/puddle
```### Usage
```golang
numWorkers := 3
p := puddle.New(numWorkers)// Add job to our worker pool
p.Job(func() {
fmt.Printf("%s", "Hello")
// ...
})p.Job(func() {
fmt.Printf("%s\n", ", World!")
// ...
})// You must always Seal the Puddle
// You CANNOT add jobs after Sealing the Puddle
p.Seal()
```