* threads.scm (letpar): New macro.
authorMikael Djurfeldt <djurfeldt@nada.kth.se>
Mon, 9 Dec 2002 12:58:52 +0000 (12:58 +0000)
committerMikael Djurfeldt <djurfeldt@nada.kth.se>
Mon, 9 Dec 2002 12:58:52 +0000 (12:58 +0000)
ice-9/ChangeLog
ice-9/threads.scm

index bca320e..4566031 100644 (file)
@@ -1,3 +1,7 @@
+2002-12-09  Mikael Djurfeldt  <djurfeldt@nada.kth.se>
+
+       * threads.scm (letpar): New macro.
+
 2002-12-08  Rob Browning  <rlb@defaultvalue.org>
 
        * debugger/breakpoints/Makefile.am (subpkgdatadir): VERSION ->
@@ -10,7 +14,8 @@
 
 2002-12-04  Mikael Djurfeldt  <mdj@linnaeus>
 
-       * threads.scm (par-map, par-for-each, parallel): 
+       * threads.scm (parallel): New macro.
+        (par-map, par-for-each): New procedures.
 
        * documentation.scm (object-documentation): Added support for
        defmacros.
index c552a85..f5d178a 100644 (file)
@@ -63,6 +63,7 @@
   :export-syntax (make-thread
                  begin-thread
                  parallel
+                 letpar
                  with-mutex
                  monitor))
 
              (wait-condition-variable ,c ,m)
              (values ,@vars))))))
 
+(defmacro letpar (bindings . body)
+  `(call-with-values
+       (lambda ()
+        (parallel ,@(map cadr bindings)))
+     (lambda ,(map car bindings)
+       ,@body)))
+
 (defmacro with-mutex (m . body)
   `(dynamic-wind
        (lambda () (lock-mutex ,m))