chickadee » sicp » parallel-execute

parallel-execute #!rest thunksprocedure

Executes thunks in parallel; returns a thunk which can be executed to terminate the threads.

thunks
The thunks to execute in parallel
(define (parallel-execute . thunks)
  (let ((threads (map thunk->thread thunks)))
    (lambda () (for-each thread-terminate! threads))))