mirror of
https://github.com/logos-storage/apatheia.git
synced 2026-01-03 13:33:08 +00:00
combining together
This commit is contained in:
parent
834f54b8ba
commit
14d65a5060
@ -33,20 +33,23 @@ macro asyncTask*(p: untyped): untyped =
|
||||
params, body)
|
||||
|
||||
var asyncBody = newStmtList()
|
||||
let tcall = newCall(ident name)
|
||||
let tcall = newCall(ident(name & "Tasklet"))
|
||||
for paramId, paramType in paramsIter(params):
|
||||
echo "param: ", paramId, " tp: ", paramType.treeRepr
|
||||
tcall.add newCall("checkParamType", paramId)
|
||||
asyncBody.add tcall
|
||||
asyncBody.add quote do:
|
||||
let res = `tcall`
|
||||
var asyncParams = params.copyNimTree()
|
||||
let retType = if not hasReturnType(params): ident"void"
|
||||
else: params.getReturnType()
|
||||
echo "RETTYPE: ", retType.repr
|
||||
# let jobRes = genSym(nskLet, "jobRes")
|
||||
# asyncParams.insert(0, )
|
||||
let jobArg = nnkIdentDefs.newTree(
|
||||
ident"jobResult",
|
||||
nnkBracketExpr.newTree(ident"JobResult", retType),
|
||||
newEmptyNode()
|
||||
)
|
||||
asyncParams.insert(1, jobArg)
|
||||
let fn = mkProc(procId, asyncParams, asyncBody)
|
||||
|
||||
|
||||
# echo "asyncTask:fn:body:\n", fn.treerepr
|
||||
|
||||
result = newStmtList()
|
||||
@ -61,11 +64,11 @@ type
|
||||
|
||||
proc doHashes*(data: openArray[byte],
|
||||
opts: HashOptions) {.asyncTask.} =
|
||||
discard
|
||||
echo "hashing"
|
||||
|
||||
proc doHashes2*(data: openArray[byte],
|
||||
opts: HashOptions): float {.asyncTask.} =
|
||||
discard
|
||||
echo "hashing"
|
||||
|
||||
# proc doHashesRes*(data: openArray[byte],
|
||||
# opts: HashOptions): int {.asyncTask.} =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user