mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 06:20:23 +02:00
futures: Fix potential deadlock.
* module/ice-9/futures.scm (process-futures): Fix potential deadlock, whereby %FUTURES-MUTEX would be acquired *after* FUTURE's mutex.
This commit is contained in:
parent
70249b9857
commit
691a1c3c06
1 changed files with 3 additions and 2 deletions
|
@ -101,7 +101,8 @@ touched."
|
|||
(() (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)
|
||||
|
@ -115,9 +116,9 @@ touched."
|
|||
(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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue