In the book page 258, the authors implement make-serializer
like this:
(define (make-serializer)
(let ((mutex (make-mutex)))
(lambda (p)
(define (serialized-p . args)
(mutex 'acquire)
(let ((val (apply p args)))
(mutex 'release)
val))
serialized-p)))
In the book, there is a segment
Given a procedure p, the serializer returns a procedure that acquires the mutex, runs p, and then releases the mutex.
I have a question: why is val
after release
? I think val
should be in the front of mutex 'release
. Am I right?