Skip to content

matthewoestreich/puddle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

puddle

Puddle is a worker pool that was forked from workerpool and meant to help me learn channels and concurrency design.

The biggest difference is workerpool uses a custom ring buffer implementation while puddle uses the built-in container/list package.


*not designed for production use*


Install

go get -u github.com/oze4/puddle

Usage

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()

About

Puddle is a fork of `github.com/gammazero/workerpool` and meant for learning purposes.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages