diff --git a/util/async.lisp b/util/async.lisp index a531cb1..c5c711d 100644 --- a/util/async.lisp +++ b/util/async.lisp @@ -5,7 +5,8 @@ (:local-nicknames (:lp :lparallel) (:lpq :lparallel.queue) (:util :scopes/util)) - (:export #:+quit-message+ #:init #:finish #:make-mb #:make-task #:rcv #:try-rcv #:snd + (:export #:thread + #:+quit-message+ #:init #:finish #:make-mb #:make-task #:rcv #:try-rcv #:snd #:mailbox #:task #:restartable-task #:behavior #:get-status #:set-status #:submit-task #:receive-result #:try-receive-result)) @@ -13,6 +14,11 @@ (defconstant +quit-message+ :quit) +;;;; simple anonymous thread with callback + +(defun thread (fn cb &rest args) + (bt:make-thread (lambda () (funcall cb (apply fn args))))) + ;;;; general definitions (lparallel wrappers) (defun init ()