This commit is contained in:
Jaremy Creechley 2024-02-14 21:38:04 -07:00
parent 37fbfe9867
commit 1a54fc42c1
3 changed files with 5 additions and 3 deletions

View File

@ -10,6 +10,6 @@ srcDir = "src"
requires "chronos >= 4.0.0"
requires "threading"
requires "taskpools"
requires "taskpools >= 0.0.5"
requires "chronicles"

View File

@ -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

View File

@ -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"