Mercurial > hg > Members > kono > jpf-core
comparison src/main/gov/nasa/jpf/vm/AllRunnablesSyncPolicy.java @ 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 | 61d41facf527 |
children |
comparison
equal
deleted
inserted
replaced
9:8de43b2b023f | 10:87e9c7544a06 |
---|---|
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 | 70 |
71 protected ChoiceGenerator<ThreadInfo> getRunnableCG (String id, ThreadInfo tiCurrent){ | 71 protected ChoiceGenerator<ThreadInfo> getRunnableCG (String id, ThreadInfo tiCurrent){ |
72 ThreadInfo[] choices = getTimeoutRunnables(tiCurrent.getApplicationContext()); | 72 ApplicationContext appCtx = tiCurrent.getApplicationContext(); |
73 ThreadInfo[] choices = getTimeoutRunnables(appCtx); | |
73 | 74 |
74 if (choices.length == 0){ | 75 if (choices.length == 0){ |
75 return null; | 76 return null; |
76 } | 77 } |
77 | 78 |
79 if (!breakSingleChoice){ | 80 if (!breakSingleChoice){ |
80 return null; | 81 return null; |
81 } | 82 } |
82 } | 83 } |
83 | 84 |
84 return new ThreadChoiceFromSet( id, choices, true); | 85 ChoiceGenerator<ThreadInfo> cg = new ThreadChoiceFromSet( id, choices, true); |
86 | |
87 if(!vm.getThreadList().hasProcessTimeoutRunnables(appCtx)) { | |
88 GlobalSchedulingPoint.setGlobal(cg); | |
89 } | |
90 | |
91 return cg; | |
85 } | 92 } |
86 | 93 |
87 protected boolean setNextChoiceGenerator (ChoiceGenerator<ThreadInfo> cg){ | 94 protected boolean setNextChoiceGenerator (ChoiceGenerator<ThreadInfo> cg){ |
88 if (cg != null){ | 95 if (cg != null){ |
89 return vm.getSystemState().setNextChoiceGenerator(cg); // listeners could still remove CGs | 96 return vm.getSystemState().setNextChoiceGenerator(cg); // listeners could still remove CGs |