SkillAgentSearch skills...

Gool

Generic goroutine pool: Submit, Map, Async.

Install / Use

/learn @txaty/Gool
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

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.

View on GitHub
GitHub Stars72
CategoryDevelopment
Updated1y ago
Forks2

Languages

Go

Security Score

85/100

Audited on Nov 2, 2024

No findings