fix actor flow: ac-loop, send

This commit is contained in:
Helmut Merz 2025-06-16 14:40:00 +02:00
parent dfb6ca23c9
commit 17899b934c

View file

@ -83,11 +83,11 @@
(if ok (if ok
(if (eq (content msg) +quit-message+) (if (eq (content msg) +quit-message+)
(progn (async:set-status tsk :stopped) nil) (progn (async:set-status tsk :stopped) nil)
(let ((*self* tsk)) (progn
(async:set-status tsk :running) (async:set-status tsk :running)
;(ac-loop tsk (or (funcall bhv msg) bhv)) (let ((*self* tsk))
(funcall bhv msg) (funcall bhv msg)
(ac-loop tsk (async:behavior tsk)))) (ac-loop tsk (async:behavior tsk)))))
(progn (async:set-status tsk :suspended) bhv)))) (progn (async:set-status tsk :suspended) bhv))))
(defmethod send ((tsk async:restartable-task) msg) (defmethod send ((tsk async:restartable-task) msg)
@ -97,7 +97,7 @@
(async:set-status tsk :stopped) (async:set-status tsk :stopped)
(return-from send)) (return-from send))
(async:snd tsk msg) (async:snd tsk msg)
(when (or (eq status :new) (eq status :suspended)) (unless (eq status :running)
(async:try-receive-result tsk) (async:try-receive-result tsk)
(async:submit-task (async:submit-task
tsk (lambda () (ac-loop tsk (async:behavior tsk))))) tsk (lambda () (ac-loop tsk (async:behavior tsk)))))