mirror of
https://github.com/logos-storage/apatheia.git
synced 2026-01-04 05:53:11 +00:00
refactoring
This commit is contained in:
parent
3727c4855b
commit
fbad0e13a5
@ -72,6 +72,6 @@ template submit*[T](jobs: JobQueue[T], exp: untyped): Future[T] =
|
|||||||
|
|
||||||
template jobWrapper*(task: untyped) =
|
template jobWrapper*(task: untyped) =
|
||||||
template `task Wrapper`*(jobResult: JobResult[float], args: varargs[untyped]) =
|
template `task Wrapper`*(jobResult: JobResult[float], args: varargs[untyped]) =
|
||||||
let res = unpackVarargs(`task`(args))
|
let res = unpackVarargs(`task`, args)
|
||||||
discard jobResult.queue.send((jobResult.id, res,))
|
discard jobResult.queue.send((jobResult.id, res,))
|
||||||
|
|
||||||
|
|||||||
@ -20,8 +20,6 @@ proc addNums(jobResult: JobResult[float], a, b: float) =
|
|||||||
let res = addNumsRaw(a, b)
|
let res = addNumsRaw(a, b)
|
||||||
discard jobResult.queue.send((jobResult.id, res,))
|
discard jobResult.queue.send((jobResult.id, res,))
|
||||||
|
|
||||||
jobWrapper(addNumsRaw)
|
|
||||||
|
|
||||||
suite "async tests":
|
suite "async tests":
|
||||||
|
|
||||||
# var tp = Taskpool.new(num_threads = 2) # Default to the number of hardware threads.
|
# var tp = Taskpool.new(num_threads = 2) # Default to the number of hardware threads.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user