From 14392e838f13ca6c650e079221d0473f6f8207fa Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Tue, 13 Feb 2024 22:43:26 -0700 Subject: [PATCH] setting up wrappers --- src/apatheia/tasks.nim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/apatheia/tasks.nim b/src/apatheia/tasks.nim index b41c9bd..f73a7e9 100644 --- a/src/apatheia/tasks.nim +++ b/src/apatheia/tasks.nim @@ -39,8 +39,12 @@ macro asyncTask*(p: untyped): untyped = for paramId, paramType in paramsIter(params): echo "param: ", paramId, " tp: ", paramType.treeRepr tcall.add newCall("checkParamType", paramId) - asyncBody.add quote do: - let res = `tcall` + # asyncBody.add nnkLetSection.newTree( + # nnkIdentDefs.newTree(ident"res", newEmptyNode(), tcall)) + asyncBody = quote do: + let res {.inject.} = `tcall` + discard jobResult.queue.send((jobResult.id, res,)) + var asyncParams = params.copyNimTree() let retType = if not hasReturnType(params): ident"void" else: params.getReturnType() @@ -72,6 +76,7 @@ proc doHashes2*(data: openArray[byte], opts: HashOptions): float {.asyncTask.} = echo "hashing" + # proc doHashesRes*(data: openArray[byte], # opts: HashOptions): int {.asyncTask.} = # # echo "args: ", args.len()