From b3c03fcde56395483134adf54b6bb4bf9917d271 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sun, 7 Sep 2025 17:47:42 +0200 Subject: [PATCH] async: add simple wrapper around bordeaux-threads:make-thread --- util/async.lisp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 ()