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)