chickadee » sicp » make-serializer

make-serializerprocedure

Creates a serializer which returns serialized procedures in a common set; returns a procedure taking f, the procedure to serialize.

(define (make-serializer)
  (let ((mutex (make-mutex)))
    (lambda (f)
      (lambda args (with-mutex-locked mutex (lambda () (apply f args)))))))