+ action_list_t *list=generateSC(actions);
+ print_list(list);
+}
+
+ModelAction * SCAnalysis::getNextAction() {
+ ModelAction *act=NULL;
+ for(int i=0;i<=maxthreads;i++) {
+ action_list_t * threadlist=&(*threadlists)[i];
+ if (threadlist->empty())
+ continue;
+ ModelAction *first=threadlist->front();
+ if (act==NULL) {
+ act=first;
+ continue;
+ }
+ ClockVector *cv=cvmap->get(act);
+ if (cv->synchronized_since(first)) {
+ act=first;
+ }
+ }
+ return act;
+}
+
+action_list_t * SCAnalysis::generateSC(action_list_t *list) {
+ action_list_t *sclist=new action_list_t();
+ while (true) {
+ ModelAction * act=getNextAction();
+ if (act==NULL)
+ break;
+ thread_id_t tid=act->get_tid();
+ //remove action
+ (*threadlists)[id_to_int(tid)].pop_front();
+ //add ordering constraints from this choice
+ if (updateConstraints(act)) {
+ //propagate changes if we have them
+ computeCV(list);
+ }
+ //add action to end
+ sclist->push_back(act);
+ }
+ return sclist;