From 1a54fc42c19a8eba776a79c3dbef40f96c5e8243 Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Wed, 14 Feb 2024 21:38:04 -0700 Subject: [PATCH] rename --- apatheia.nimble | 2 +- src/apatheia/jobs.nim | 3 ++- tests/tjobs.nim | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apatheia.nimble b/apatheia.nimble index d947783..7bda637 100644 --- a/apatheia.nimble +++ b/apatheia.nimble @@ -10,6 +10,6 @@ srcDir = "src" requires "chronos >= 4.0.0" requires "threading" -requires "taskpools" +requires "taskpools >= 0.0.5" requires "chronicles" diff --git a/src/apatheia/jobs.nim b/src/apatheia/jobs.nim index 6c93a06..1e07e88 100644 --- a/src/apatheia/jobs.nim +++ b/src/apatheia/jobs.nim @@ -75,7 +75,8 @@ macro submitMacro(tp: untyped, jobs: untyped, exp: untyped): untyped = result = quote do: let (`jobRes`, `futName`) = createFuture(`jobs`, `nm`) - `jobs`.taskpool.spawn(`fncall`) + expandMacros: + `jobs`.taskpool.spawn(`fncall`) `futName` echo "submit: res:\n", result.repr diff --git a/tests/tjobs.nim b/tests/tjobs.nim index 8d186c3..b71de4c 100644 --- a/tests/tjobs.nim +++ b/tests/tjobs.nim @@ -12,6 +12,8 @@ import apatheia/jobs ## todo: setup basic async + threadsignal + taskpools example here ## +import std/macros + proc addNumsRaw(a, b: float): float = os.sleep(500) echo "adding: ", a, " + ", b @@ -29,7 +31,6 @@ suite "async tests": var tp = Taskpool.new(num_threads = 2) # Default to the number of hardware threads. asyncTest "test": - var jobs = newJobQueue[float](taskpool = tp) echo "\nstart"