Next: , Previous: , Up: Miscellaneous   [Contents]


3.3.3 Asynchronous Execution

A wait-for-pipelines macro is provided as a thin wrapper around (ice-9 futures) that allows for running multiple pipelines in parallel while executing other code. This macro takes a list of pipelines to evaluate in the same form as parallel-pipelines as well as a series of statements to evaluate.

wait-for-pipelines returns two values. The first is the value returned by the last statement and the second is a list of blocks created by running the pipelines.

(wait-for-pipelines
 `(((,a ,b))
   ((,c ,d) ,e))
 (+ 1 2)                 ;any number of statements can follow the pipelines
 (+ 3 4))
;; => 7
;; => (list (run-blocks `((,a ,b)))
;;          (run-blocks `((,c ,d) e)))