Need an onStop
This commit is contained in:
parent
ff1e1e6231
commit
b2f680a215
3
Tupfile
3
Tupfile
|
@ -1,2 +1,3 @@
|
|||
include_rules
|
||||
: lock.json |> !nim_cfg |> | ./<lock>
|
||||
: |> !nim_lk |> {lockfile}
|
||||
: {lockfile} |> !nim_cfg |> | ./<lock>
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue