From 2a4f421a74b6e31e7718d206be704f1d42a268a2 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Sun, 3 Nov 2013 15:42:25 +0100 Subject: [PATCH] Improving with-engine * src/engine.scm: with-engine now saves current engine for recursive calls and uses engine mutex for exclusive access --- src/engine.scm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/engine.scm b/src/engine.scm index 6d5e0e7..0770e09 100644 --- a/src/engine.scm +++ b/src/engine.scm @@ -94,10 +94,12 @@ (define-syntax with-engine (syntax-rules () ((_ engine body ...) - (begin + (let ((old-engine (current-engine))) (set-current-engine! engine) - (let ((res (begin body ...))) - (set-current-engine! #f) + (let ((res (with-mutex (engine-mutex engine) + body + ...))) + (set-current-engine! old-engine) res))))) (export current-engine -- 2.39.5