- (mutex-lock! pop-mutex #f #f)
- (if (null? head)
- (error "FIFO empty.")
- (let ((old-tail tail))
- (set! tail (cell-prev old-tail))
- (if (null? tail)
- (set! head '())
- (begin
- (set-cell-next! tail '())
- (mutex-unlock! pop-mutex #f #f)))
- (cell-val old-tail)))))
- ((->list) (if (not (= (length args) 0))
- (error "Wrong number of arguments to ->list.")
- (let loop ((this-cell head))
- (if (null? this-cell)
- '()
- (cons (cell-val this-cell)
- (loop (cell-next this-cell))))))))))
+ (let ((old-tail tail))
+ (set! tail (cell-prev old-tail))
+ (if (null? tail)
+ (set! head '())
+ (set-cell-next! tail '()))
+ (cell-val old-tail)))
+ ((->list)
+ (let loop ((this-cell head))
+ (if (null? this-cell)
+ '()
+ (cons (cell-val this-cell)
+ (loop (cell-next this-cell))))))))))