cozytaskpool
Cozy Task pool
Summary
| Latest Version | 0.1.3 |
|---|---|
| License | GPL-2.0-or-later |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:25 |
Tags
Authors
- Kirill I
Installation
nimble install cozytaskpool
choosenim install cozytaskpool
git clone https://github.com/indiscipline/cozytaskpool
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| cozytaskpool | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Dependencies
| Package | Version | Optional |
|---|---|---|
| nim >= | 1.6.8 | No |
| threading >= | 0.2.1 | No |
Source
| Repository | https://github.com/indiscipline/cozytaskpool |
|---|---|
| Homepage | https://github.com/indiscipline/cozytaskpool |
| Registry Source | nimble_official |
README
Cozy Task Pool
Just a repeating pattern of launching tasks concurrently in threads with threading/channels, extracted into its own micro package.
Not very ergonomic, just hides some of the boilerplate of preparing and tearing down everything.
Requires --threads:on and (--mm:arc / --mm:atomicArc / --mm:orc)
Installation
Cozy Task Pool is in the nimble directory, use atlas or nimble to install:
atlas use cozytaskpool
nimble install cozytaskpool
Usage
Look at the executable part of the source, which is almost the copy of the following block:
import std/[tasks], threading/channels
var
data = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61]
pool: CozyTaskPool = newTaskPool()
proc log(inputData: int) =
echo "Received some message about ", inputData
proc work(consumer: Chan[Task]; inputData: int) =
doTheWork(inputData)
consumer.send(toTask( log(inputData) ))
for x in data:
pool.sendTask(toTask( work(pool.resultsChan(), x) ))
pool.stopPool()
License
Cozy Task Pool is licensed under GNU General Public License version 2.0 or later.