* module/ice-9/futures.scm (process-futures): Fix potential deadlock,
whereby %FUTURES-MUTEX would be acquired *after* FUTURE's mutex.
(() (loop))
((future _ ...)
(lock-mutex (future-mutex future))
- (or (future-done? future)
+ (or (and (future-done? future)
+ (unlock-mutex (future-mutex future)))
(begin
;; Do the actual work.
(unregister-future! future)
(lock-mutex (future-mutex future))
(or (future-done? future) ; lost the race?
(process-future! future))
+ (unlock-mutex (future-mutex future))
(lock-mutex %futures-mutex)))
- (unlock-mutex (future-mutex future))
(loop)))))
(define (touch future)