changeset 10:87e9c7544a06

Made getRunnableCG add GlobalSchedulingPoint as an attribute to global choice generators that capture choices from multiple processes.
author nastaran <nastaran.shafiei@gmail.com>
date Wed, 25 Feb 2015 09:42:13 -0800
parents 8de43b2b023f
children ca88bd8e918c
files src/main/gov/nasa/jpf/vm/AllRunnablesSyncPolicy.java
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/gov/nasa/jpf/vm/AllRunnablesSyncPolicy.java	Fri Feb 13 20:20:15 2015 -0800
+++ b/src/main/gov/nasa/jpf/vm/AllRunnablesSyncPolicy.java	Wed Feb 25 09:42:13 2015 -0800
@@ -69,7 +69,8 @@
 
     
   protected ChoiceGenerator<ThreadInfo> getRunnableCG (String id, ThreadInfo tiCurrent){
-    ThreadInfo[] choices = getTimeoutRunnables(tiCurrent.getApplicationContext());
+    ApplicationContext appCtx = tiCurrent.getApplicationContext();
+    ThreadInfo[] choices = getTimeoutRunnables(appCtx);
     
     if (choices.length == 0){
       return null;
@@ -81,7 +82,13 @@
       }
     }
     
-    return new ThreadChoiceFromSet( id, choices, true);
+    ChoiceGenerator<ThreadInfo> cg = new ThreadChoiceFromSet( id, choices, true);
+    
+    if(!vm.getThreadList().hasProcessTimeoutRunnables(appCtx)) {
+      GlobalSchedulingPoint.setGlobal(cg);
+    }
+    
+    return cg;
   }
   
   protected boolean setNextChoiceGenerator (ChoiceGenerator<ThreadInfo> cg){