From eef43f090e4b067add6f94800d0a27339a666d28 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sun, 15 Jun 2025 22:38:24 +0200 Subject: [PATCH] work in progress: use new async task definition --- core/actor.lisp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/core/actor.lisp b/core/actor.lisp index 6945277..d607bfa 100644 --- a/core/actor.lisp +++ b/core/actor.lisp @@ -47,10 +47,11 @@ (defun stop (mb) (send mb +quit-message+)) -(defun ac-loop (mb bhv) - (let ((msg (async:rcv mb))) - (unless (eq (content msg) +quit-message+) - (ac-loop mb (or (funcall bhv msg) bhv))))) +(defgeneric ac-loop (tsk bhv) + (:method ((tsk async:mailbox) bhv) + (let ((msg (async:rcv tsk))) + (unless (eq (content msg) +quit-message+) + (ac-loop tsk (or (funcall bhv msg) bhv)))))) (defun ac-vloop (mb bhv) (multiple-value-bind (msg ok) (async:try-rcv mb) @@ -64,9 +65,9 @@ ;;; there is no `become` operation: the behavior just returns the new behavior (defun create (bhv) - (let ((mb (async:make-mb))) - (start mb bhv) - mb)) + (let ((tsk (async:make-task bhv))) + (start tsk bhv) + tsk)) (defun send (mb msg) ;(util:lgi msg)