From fc85d095600162567fd0aa563eed9e6eada3e889 Mon Sep 17 00:00:00 2001 From: Mikael Djurfeldt Date: Mon, 9 Dec 2002 12:58:52 +0000 Subject: [PATCH] * threads.scm (letpar): New macro. --- ice-9/ChangeLog | 7 ++++++- ice-9/threads.scm | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ice-9/ChangeLog b/ice-9/ChangeLog index bca320e72..456603177 100644 --- a/ice-9/ChangeLog +++ b/ice-9/ChangeLog @@ -1,3 +1,7 @@ +2002-12-09 Mikael Djurfeldt + + * threads.scm (letpar): New macro. + 2002-12-08 Rob Browning * debugger/breakpoints/Makefile.am (subpkgdatadir): VERSION -> @@ -10,7 +14,8 @@ 2002-12-04 Mikael Djurfeldt - * 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. diff --git a/ice-9/threads.scm b/ice-9/threads.scm index c552a8596..f5d178a4e 100644 --- a/ice-9/threads.scm +++ b/ice-9/threads.scm @@ -63,6 +63,7 @@ :export-syntax (make-thread begin-thread parallel + letpar with-mutex monitor)) @@ -188,6 +189,13 @@ (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))