Need an onStop

This commit is contained in:
Emery Hemingway 2024-02-15 14:34:13 +00:00
parent ff1e1e6231
commit b2f680a215
4 changed files with 13 additions and 8 deletions

View File

@ -1,2 +1,3 @@
include_rules
: lock.json |> !nim_cfg |> | ./<lock>
: |> !nim_lk |> {lockfile}
: {lockfile} |> !nim_cfg |> | ./<lock>

View File

@ -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"
}
]
}

View File

@ -3,4 +3,5 @@ NIM_FLAGS += --define:traceSyndicate
: foreach *.prs |> !preserves_schema_nim |> | {schema}
: foreach t*.nim | ../../preserves-nim/<tests> {schema} $(SYNDICATE_PROTOCOL) |> !nim_run |> | ../<test>
: 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

View File

@ -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())