[m-rev.] diff 2/3: [java] Fix locking bug in Java ThreadPool.

Paul Bone paul at bone.id.au
Tue Dec 16 10:15:17 AEDT 2014


Branches: master

---

[java] Fix locking bug in Java ThreadPool.

Fix a bug that made it possible that the tasks_lock could be locked but
never unlocked if an exception was thrown.

java/runtime/MercuryThreadPool.java:
    As above.
---
 java/runtime/MercuryThreadPool.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/java/runtime/MercuryThreadPool.java b/java/runtime/MercuryThreadPool.java
index 142b2e6..4b63460 100644
--- a/java/runtime/MercuryThreadPool.java
+++ b/java/runtime/MercuryThreadPool.java
@@ -455,6 +455,7 @@ public class MercuryThreadPool
                  * Have all the tasks been completed?
                  */
                 tasks_lock.lock();
+                tasks_locked = true;
                 try {
                     num_tasks_submitted = this.num_tasks_submitted;
                     num_tasks_completed = this.num_tasks_completed;
-- 
2.1.3




More information about the reviews mailing list