API renaming

This commit is contained in:
Emery Hemingway 2024-03-01 14:10:20 +00:00
parent fdf2994ec4
commit e31069e41a
2 changed files with 10 additions and 5 deletions

View File

@ -4,6 +4,7 @@
## This module implements the `Syndicate DSL <https://syndicate-lang.org/doc/syndicate/>`_.
import std/[macros, tables, typetraits]
import pkg/sys/ioqueue
import preserves
export fromPreserves, toPreserves
@ -194,7 +195,7 @@ proc runActor*(name: string; bootProc: BootProc) =
## Run an `Actor` to completion.
let actor = bootDataspace(name, bootProc)
while actor.running:
waitFor sleepAsync(500)
ioqueue.run()
proc runActor*(name: string; bootProc: DeprecatedBootProc) {.deprecated.} =
## Run an `Actor` to completion.

View File

@ -457,7 +457,7 @@ proc bootActor*(name: string; bootProc: TurnAction): Actor =
else: result.traceStream = openFileStream(path, fmWrite)
run(result, bootProc, initialAssertions)
proc spawn*(name: string; turn: var Turn; bootProc: TurnAction; initialAssertions = initHashSet[Handle]()): Actor {.discardable.} =
proc spawnActor*(name: string; turn: var Turn; bootProc: TurnAction; initialAssertions = initHashSet[Handle]()): Actor {.discardable.} =
let actor = newActor(name, turn.facet.actor.handleAllocator)
enqueue(turn, turn.facet) do (turn: var Turn):
var newOutBound: Table[Handle, OutboundAssertion]
@ -581,10 +581,14 @@ proc onStop*(facet: Facet; act: TurnAction) =
## Add a `proc (turn: var Turn)` action to `facet` to be called as it stops.
add(facet.shutdownActions, act)
proc stopActor*(facet: Facet) =
run(facet) do (turn: var Turn):
let actor = facet.actor
enqueue(turn, actor.root) do (turn: var Turn):
terminate(actor, turn, nil)
proc stopActor*(turn: var Turn) =
let actor = turn.facet.actor
enqueue(turn, actor.root) do (turn: var Turn):
terminate(actor, turn, nil)
stopActor(turn.facet)
proc freshen*(turn: var Turn, act: TurnAction) =
assert(turn.queues.len == 0, "Attempt to freshen a non-stale Turn")