From 02c8e68ced11061ff9a3eef73663f626258ae2e9 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Mon, 16 Jun 2025 10:53:36 +0200 Subject: [PATCH] actor with restartable task now active (+ async fixes) --- core/actor.lisp | 6 +++--- util/async.lisp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/actor.lisp b/core/actor.lisp index fdf98dd..90b7acb 100644 --- a/core/actor.lisp +++ b/core/actor.lisp @@ -62,7 +62,7 @@ ;;;; the core (classical, i.e. Hewitt) actor API (defun create (bhv) - (let ((tsk (async:make-task bhv))) + (let ((tsk (async:make-task bhv :restartable t))) (start tsk bhv) tsk)) @@ -99,7 +99,7 @@ (async:try-receive-result tsk) (async:submit-task tsk (lambda () (ac-loop tsk (async:behavior tsk))))) - (async:set-status :running))) + (async:set-status tsk :running))) (defmethod set-bhv ((tsk async:task) bhv) (setf (async:behavior tsk) bhv)) @@ -120,7 +120,7 @@ (lambda (msg) ;(format t "calc ~a ~a~%" val (content msg)) (destructuring-bind (fn &optional param) (content msg) - (become (funcall fn msg val param))))) + (funcall fn msg val param)))) (defun plus (msg val param) (calculator (+ val param))) diff --git a/util/async.lisp b/util/async.lisp index 724b750..c163744 100644 --- a/util/async.lisp +++ b/util/async.lisp @@ -55,7 +55,7 @@ (defclass restartable-task (task) ((status :reader status - :initform (lp:make-channel :fixed-capacity 1 :initial-contents '(:new))))) + :initform (lpq:make-queue :fixed-capacity 1 :initial-contents '(:new))))) (defun make-task (bhv &key restartable (cls 'task)) (if restartable (setf cls 'restartable-task))