3 (define (make-serializer)
4 (let ([mutex (make-mutex)])
6 (define (serialized-p . args)
8 (let ([val (apply p args)])
14 (let ([cell (mcons #f '())])
16 (cond [(eq? m 'acquire)
17 (when (test-and-set! cell)
18 (the-mutex 'acquire))] ;; loop till we acquire the mutex
19 [(eq? m 'release) (clear! cell)]))
25 (define (test-and-set! cell)
28 (begin (set-mcar! cell #t)