[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#61058: [PATCH] Fix asymetric mutex locking when joining thread.
From: |
Olivier Dion |
Subject: |
bug#61058: [PATCH] Fix asymetric mutex locking when joining thread. |
Date: |
Wed, 25 Jan 2023 10:24:03 -0500 |
From: Olivier Dion <olivier-dion@proton.me>
If `join-thread' timeout, the thread mutex is not unlocked,
resulting in deadlock to the next call to it or deadlock of the
thread itself when it terminates.
Thus, always unlock the mutex.
Fix: #55356
* module/ice-9/threads.scm (join-thread): Always unlock thread mutex.
---
module/ice-9/threads.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/module/ice-9/threads.scm b/module/ice-9/threads.scm
index c42bd266f..962caee70 100644
--- a/module/ice-9/threads.scm
+++ b/module/ice-9/threads.scm
@@ -197,7 +197,9 @@ terminates, unless the target @var{thread} has already
terminated."
(wait-condition-variable cv mutex timeout)
(wait-condition-variable cv mutex))
(lp))
- (else timeoutval))))))
+ (else
+ (unlock-mutex mutex)
+ timeoutval))))))
(define* (try-mutex mutex)
"Try to lock @var{mutex}. If the mutex is already locked, return
--
2.39.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#61058: [PATCH] Fix asymetric mutex locking when joining thread.,
Olivier Dion <=