work in progress: use new async task definition
This commit is contained in:
parent
2042748fc8
commit
eef43f090e
1 changed files with 8 additions and 7 deletions
|
@ -47,10 +47,11 @@
|
||||||
(defun stop (mb)
|
(defun stop (mb)
|
||||||
(send mb +quit-message+))
|
(send mb +quit-message+))
|
||||||
|
|
||||||
(defun ac-loop (mb bhv)
|
(defgeneric ac-loop (tsk bhv)
|
||||||
(let ((msg (async:rcv mb)))
|
(:method ((tsk async:mailbox) bhv)
|
||||||
|
(let ((msg (async:rcv tsk)))
|
||||||
(unless (eq (content msg) +quit-message+)
|
(unless (eq (content msg) +quit-message+)
|
||||||
(ac-loop mb (or (funcall bhv msg) bhv)))))
|
(ac-loop tsk (or (funcall bhv msg) bhv))))))
|
||||||
|
|
||||||
(defun ac-vloop (mb bhv)
|
(defun ac-vloop (mb bhv)
|
||||||
(multiple-value-bind (msg ok) (async:try-rcv mb)
|
(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
|
;;; there is no `become` operation: the behavior just returns the new behavior
|
||||||
|
|
||||||
(defun create (bhv)
|
(defun create (bhv)
|
||||||
(let ((mb (async:make-mb)))
|
(let ((tsk (async:make-task bhv)))
|
||||||
(start mb bhv)
|
(start tsk bhv)
|
||||||
mb))
|
tsk))
|
||||||
|
|
||||||
(defun send (mb msg)
|
(defun send (mb msg)
|
||||||
;(util:lgi msg)
|
;(util:lgi msg)
|
||||||
|
|
Loading…
Add table
Reference in a new issue