From ffe8477237462d77ac0243b20d8f5addadd34594 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sat, 13 Oct 2007 20:02:07 +0000 Subject: [PATCH] Added a fix to prevent running a zero-length list of processes in CIF --- backends/GenerateC.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backends/GenerateC.hs b/backends/GenerateC.hs index eb131c1..dcbf797 100644 --- a/backends/GenerateC.hs +++ b/backends/GenerateC.hs @@ -1708,9 +1708,12 @@ cgenPar ops pm s tell ["int ", index, " = 0;\n"] call genStructured ops s (createP pids pris index) tell [pids, "[", index, "] = NULL;\n"] + tell ["if(",pids,"[0] != NULL){"] -- CIF seems to deadlock when you give ProcParList a list + -- beginning with NULL (i.e. with no processes) case pm of A.PriPar -> tell ["ProcPriParList (", pids, ", ", pris, ");\n"] _ -> tell ["ProcParList (", pids, ");\n"] + tell ["}"] tell [index, " = 0;\n"] call genStructured ops s (freeP pids index) where