[polyml] 10/13: Backport fix for Test166 deadlocking

James Clarke jrtc27 at moszumanska.debian.org
Fri Aug 18 23:21:46 UTC 2017


This is an automated email from the git hooks/post-receive script.

jrtc27 pushed a commit to branch master
in repository polyml.

commit f5ed318214534c50c3aa0db83c0dc06204478ccd
Author: James Clarke <jrtc27 at debian.org>
Date:   Fri Aug 18 23:41:18 2017 +0100

    Backport fix for Test166 deadlocking
---
 debian/patches/Test166-deadlock.patch | 53 +++++++++++++++++++++++++++++++++++
 debian/patches/series                 |  2 +-
 2 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/debian/patches/Test166-deadlock.patch b/debian/patches/Test166-deadlock.patch
new file mode 100644
index 0000000..cb749b1
--- /dev/null
+++ b/debian/patches/Test166-deadlock.patch
@@ -0,0 +1,53 @@
+From 4d7c546423b337f0ae91076bf3bfc01a8c2d6d78 Mon Sep 17 00:00:00 2001
+From: David Matthews <dm at prolingua.co.uk>
+Date: Wed, 21 Jun 2017 18:30:20 +0100
+Subject: [PATCH] Fix bug in multi-thread test. This could deadlock because the
+ condition variable could be signalled before the thread was waiting.  Thanks
+ to James Clark for the finding the problem and providing the fix.
+
+---
+ Tests/Succeed/Test166.ML | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/Tests/Succeed/Test166.ML b/Tests/Succeed/Test166.ML
+index 35b31250..0dfff737 100644
+--- a/Tests/Succeed/Test166.ML
++++ b/Tests/Succeed/Test166.ML
+@@ -10,6 +10,8 @@ val bvar = conditionVar();
+ 
+ val cvar = conditionVar();
+ 
++val dvar = conditionVar();
++
+ val stop = ref false
+ 
+ val avalue = ref 0
+@@ -30,15 +32,12 @@ let
+             )
+         )
+ in
++    signal dvar;
+     loop();
+     signal cvar;
+     unlock amutex
+ end;
+ 
+-fork(incValue 1, [EnableBroadcastInterrupt true, InterruptState InterruptSynch]);
+-fork(incValue 2, [EnableBroadcastInterrupt true, InterruptState InterruptSynch]);
+-fork(incValue 3, [EnableBroadcastInterrupt true, InterruptState InterruptSynch]);
+-
+ fun addCount 0 = ()
+ |   addCount n =
+     (
+@@ -48,6 +47,11 @@ fun addCount 0 = ()
+     );
+ 
+ lock amutex;
++fork(incValue 1, [EnableBroadcastInterrupt true, InterruptState InterruptSynch]);
++fork(incValue 2, [EnableBroadcastInterrupt true, InterruptState InterruptSynch]);
++fork(incValue 3, [EnableBroadcastInterrupt true, InterruptState InterruptSynch]);
++
++wait(dvar, amutex);
+ addCount 10000;
+ OS.Process.sleep(Time.fromSeconds 2);
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 6928140..ec5347d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1 @@
-# No patches
+Test166-deadlock.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/polyml.git



More information about the debian-science-commits mailing list