From 4f4d983aa83f8fd0215bfa96522da17826597e98 Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Thu, 8 Feb 2024 20:39:13 -0700 Subject: [PATCH] setup examples --- tests/tpools.nim | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tests/tpools.nim b/tests/tpools.nim index 0df47c0..4f4a224 100644 --- a/tests/tpools.nim +++ b/tests/tpools.nim @@ -30,4 +30,34 @@ proc main() = tp.shutdown() # Compile with nim c -r -d:release --threads:on --outdir:build example.nim -main() \ No newline at end of file +main() + +when false: + type + ScratchObj_486539477 = object + k: int + fut: Flowvar[float] + + let scratch_486539455 = cast[ptr ScratchObj_486539477](c_calloc(csize_t 1, + csize_t sizeof(ScratchObj_486539477))) + if scratch_486539455.isNil: + raise newException(OutOfMemDefect, "Could not allocate memory") + block: + var isoTemp_486539473 = isolate(k) + scratch_486539455.k = extract(isoTemp_486539473) + var isoTemp_486539475 = isolate(fut) + scratch_486539455.fut = extract(isoTemp_486539475) + proc taskpool_term_486539478(args`gensym15: pointer) {.gcsafe, nimcall, + raises: [].} = + let objTemp_486539472 = cast[ptr ScratchObj_486539477](args`gensym15) + let k_486539474 = objTemp_486539472.k + let fut_486539476 = objTemp_486539472.fut + taskpool_term(k = k_486539474, fut = fut_486539476) + + proc destroyScratch_486539479(args`gensym15: pointer) {.gcsafe, nimcall, + raises: [].} = + let obj_486539480 = cast[ptr ScratchObj_486539477](args`gensym15) + `=destroy`(obj_486539480[]) + + Task(callback: taskpool_term_486539478, args: scratch_486539455, + destroy: destroyScratch_486539479) \ No newline at end of file