1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-29 16:30:19 +02:00

* threads.scm (letpar): New macro.

This commit is contained in:
Mikael Djurfeldt 2002-12-09 12:58:52 +00:00
parent 9e6e154e84
commit fc85d09560
2 changed files with 14 additions and 1 deletions

View 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> 2002-12-08 Rob Browning <rlb@defaultvalue.org>
* debugger/breakpoints/Makefile.am (subpkgdatadir): VERSION -> * debugger/breakpoints/Makefile.am (subpkgdatadir): VERSION ->
@ -10,7 +14,8 @@
2002-12-04 Mikael Djurfeldt <mdj@linnaeus> 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 * documentation.scm (object-documentation): Added support for
defmacros. defmacros.

View file

@ -63,6 +63,7 @@
:export-syntax (make-thread :export-syntax (make-thread
begin-thread begin-thread
parallel parallel
letpar
with-mutex with-mutex
monitor)) monitor))
@ -188,6 +189,13 @@
(wait-condition-variable ,c ,m) (wait-condition-variable ,c ,m)
(values ,@vars)))))) (values ,@vars))))))
(defmacro letpar (bindings . body)
`(call-with-values
(lambda ()
(parallel ,@(map cadr bindings)))
(lambda ,(map car bindings)
,@body)))
(defmacro with-mutex (m . body) (defmacro with-mutex (m . body)
`(dynamic-wind `(dynamic-wind
(lambda () (lock-mutex ,m)) (lambda () (lock-mutex ,m))