Compare commits
2 Commits
3a4dc1f133
...
aaaf373468
Author | SHA1 | Date |
---|---|---|
|
aaaf373468 | |
|
8f35a1256c |
|
@ -718,6 +718,8 @@ proc running*(actor): bool =
|
||||||
if not (result or actor.exitReason.isNil):
|
if not (result or actor.exitReason.isNil):
|
||||||
raise actor.exitReason
|
raise actor.exitReason
|
||||||
|
|
||||||
|
proc facet*(actor): Facet = actor.root
|
||||||
|
|
||||||
proc run(turn: Turn) =
|
proc run(turn: Turn) =
|
||||||
while turn.work.len > 0:
|
while turn.work.len > 0:
|
||||||
var (facet, act) = turn.work.popFirst()
|
var (facet, act) = turn.work.popFirst()
|
||||||
|
@ -743,16 +745,16 @@ proc runPendingTurns* =
|
||||||
terminateActor(turn, err)
|
terminateActor(turn, err)
|
||||||
raise err
|
raise err
|
||||||
|
|
||||||
proc runOnce*: bool {.discardable.} =
|
proc runOnce*(timeout = none(Duration)): bool {.discardable.} =
|
||||||
## Run pending turns if there are any, otherwise
|
## Run pending turns if there are any, otherwise
|
||||||
## poll for external events and run any resulting turns.
|
## poll for external events and run any resulting turns.
|
||||||
## Return true if any turns have been processed.
|
## Return true if any turns have been processed.
|
||||||
if turnQueue.len == 0:
|
if turnQueue.len == 0:
|
||||||
when defined(solo5):
|
when defined(solo5):
|
||||||
discard solo5_dispatcher.runOnce()
|
discard solo5_dispatcher.runOnce(timeout)
|
||||||
else:
|
else:
|
||||||
var ready: seq[Continuation]
|
var ready: seq[Continuation]
|
||||||
ioqueue.poll(ready)
|
ioqueue.poll(ready, timeout)
|
||||||
while ready.len > 0:
|
while ready.len > 0:
|
||||||
discard trampoline:
|
discard trampoline:
|
||||||
ready.pop()
|
ready.pop()
|
||||||
|
@ -762,7 +764,7 @@ proc runOnce*: bool {.discardable.} =
|
||||||
proc run* =
|
proc run* =
|
||||||
## Run actors to completion.
|
## Run actors to completion.
|
||||||
when defined(solo5):
|
when defined(solo5):
|
||||||
while turnQueue.len > 0 or solo5_dispatcher.runOnce():
|
while turnQueue.len > 0 or solo5_dispatcher.runOnce(timeout):
|
||||||
runPendingTurns()
|
runPendingTurns()
|
||||||
else:
|
else:
|
||||||
var ready: seq[Continuation]
|
var ready: seq[Continuation]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "20240507"
|
version = "20240522"
|
||||||
author = "Emery Hemingway"
|
author = "Emery Hemingway"
|
||||||
description = "Syndicated actors for conversational concurrency"
|
description = "Syndicated actors for conversational concurrency"
|
||||||
license = "Unlicense"
|
license = "Unlicense"
|
||||||
|
|
Loading…
Reference in New Issue