Skip to content

txaty/gool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gool

Go Reference Go Report Card codecov

A generic goroutine pool just like Python ThreadPoolExecutor.

Gool provides the following methods:

  • Submit: Submit a task and return the result (if any).
  • AsyncSubmit: Submit a task and return a future of the result (if any), the future is actually the result channel.
  • Map: Submit a bundle of tasks and return the results in order (if any).
  • AsyncMap: Submit a bundle of tasks and return the futures of the results (if any), the futures are the result channels.

To use Gool, you need to define:

  • Handler function: handler func(A) R, and
  • Argument: arg A

With types A and R being arbitrary types.

You can also specify the number of workers numWorkers and the task queue size cap when creating a new pool.