work in progress: use new async task definition

This commit is contained in:
Helmut Merz 2025-06-15 22:38:24 +02:00
parent 2042748fc8
commit eef43f090e

View file

@ -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)