From b2f680a2156f10ca784e712f3aa4d06799b31d85 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Thu, 15 Feb 2024 14:34:13 +0000 Subject: [PATCH] Need an onStop --- Tupfile | 3 ++- lock.json | 8 ++++---- tests/Tupfile | 3 ++- tests/test_timers.nim | 7 +++++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Tupfile b/Tupfile index 28c450e..eaaeaaf 100644 --- a/Tupfile +++ b/Tupfile @@ -1,2 +1,3 @@ include_rules -: lock.json |> !nim_cfg |> | ./ +: |> !nim_lk |> {lockfile} +: {lockfile} |> !nim_cfg |> | ./ diff --git a/lock.json b/lock.json index d43d474..b441c80 100644 --- a/lock.json +++ b/lock.json @@ -82,11 +82,11 @@ "packages": [ "sys" ], - "path": "/nix/store/qz3w4bgll4s3ni3v789ibmbw2x8fi5sn-source", - "rev": "4f484cd4b0884b393ee2d5773246e75b70b10e4d", - "sha256": "1mggadpvpizj48i4kb246y6vil5k4clxximisk9cm90nac3jzmzg", + "path": "/nix/store/ayplzmq7xdzrp3n6ly6dnskf5c5aiihp-source", + "rev": "3b86a5083a4aa178994fe4ffdc046d340aa13b32", + "sha256": "0qz9hag7synp8sx2b6caazm2kidvd0lv2p0h98sslkyzaf4icnal", "srcDir": "src", - "url": "https://github.com/alaviss/nim-sys/archive/4f484cd4b0884b393ee2d5773246e75b70b10e4d.tar.gz" + "url": "https://github.com/alaviss/nim-sys/archive/3b86a5083a4aa178994fe4ffdc046d340aa13b32.tar.gz" } ] } diff --git a/tests/Tupfile b/tests/Tupfile index 18ea30f..cfa33cf 100644 --- a/tests/Tupfile +++ b/tests/Tupfile @@ -3,4 +3,5 @@ NIM_FLAGS += --define:traceSyndicate : foreach *.prs |> !preserves_schema_nim |> | {schema} : foreach t*.nim | ../../preserves-nim/ {schema} $(SYNDICATE_PROTOCOL) |> !nim_run |> | ../ -: test_timers.run |> SYNDICATE_TRACE_FILE=%o ./%f |> ./%B.trace +: test_timers.run |> SYNDICATE_TRACE_FILE=%o ./%f |> ./%B.trace.bin {bintrace} +: foreach {bintrace} |> preserves-tool convert <%f >%o |> %B diff --git a/tests/test_timers.nim b/tests/test_timers.nim index 96e27f7..d5a240f 100644 --- a/tests/test_timers.nim +++ b/tests/test_timers.nim @@ -10,12 +10,15 @@ import syndicate proc now: float64 = getTime().toUnixFloat() proc main() {.syndicate.} = - discard activeTurn() let ds = newDataspace() let h = publish(ds, "hello world!".toPreserves) message(ds, "hello world!".toPreserves) retract(h) sync(ds) + + onStop: + echo "onStop body is executing" + echo "stopping actor" stopActor() echo "actor stopped but still executing?" @@ -32,7 +35,7 @@ proc main() {.syndicate.} = stderr.writeLine "slept one second twice" onPublish(ds, grab(LaterThan(seconds: now()+1.0))) do: stderr.writeLine "slept one second thrice" - quit() + stopActor() ]# bootActor("main", whelp main())