setting up wrappers

This commit is contained in:
Jaremy Creechley 2024-02-13 22:46:35 -07:00
parent e390d915fa
commit 3fd3bb2f3d
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
2 changed files with 9 additions and 13 deletions

View File

@ -32,7 +32,7 @@ suite "async tests":
var jobs = newJobQueue[float](taskpool = tp)
echo "\nstart"
let res = await jobs.submit(addNums2(1.0, 2.0,))
let res = await jobs.submit(addNums(1.0, 2.0,))
# await sleepAsync(100.milliseconds)
echo "result: ", res.repr

View File

@ -17,15 +17,11 @@ proc addNums(a, b: float): float {.asyncTask.} =
echo "adding: ", a, " + ", b
return a + b
# proc addNums(jobResult: JobResult[float], a, b: float) =
# let res = addNumsRaw(a, b)
# discard jobResult.queue.send((jobResult.id, res,))
# 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"
# let res = await jobs.submit(addNums(1.0, 2.0,))
# echo "result: ", res.repr
# check true
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"
let res = await jobs.submit(addNums(1.0, 2.0,))
echo "result: ", res.repr
check true