On Mar 4, 2006, at 1:05 PM, Thomas Chust wrote:
[...]
Maybe a macro like this one should be added to CHICKEN:
(define-macro (with-locked-mutex-specific mtx proc)
(let ((mtx-var (gensym 'mtx)))
`(let ((,mtx-var mtx))
(dynamic-wind
(lambda () (mutex-lock! ,mtx-var))
(lambda () (,proc (mutex-specific ,mtx-var)))
(lambda () (mutex-unlock! ,mtx-var))))))
I've used something like that every second time I wrote a multithreaded
program in CHICKEN so I think it could be useful as a standard extension ;)
Yes. Maybe:
(define-macro (call/synch MTX PROC)
[...]
(define-macro (apply/synch MTX PROC . REST)
[...]
(define-macro (synch MTX . BODY)
[...]