blob: 1d6a486ae5a148c221d1668204f6cb1abc08ccfe (
plain) (
tree)
|
|
(define (make-serializer)
(let ((in-use? #f))
(lambda (proc)
(define (protected-proc . args)
(if in-use?
(begin
(wait-a-while) ; Never mind how to do that.
(apply protected-proc args)) ; Try again.
(begin
(set! in-use? #t) ; Don't let anyone else in.
(apply proc args) ; Call the original procedure.
(set! in-use? #f)))) ; Finished, let others in again.
protected-proc)))
|