local commit... bug that prunes too many executions
[cdsspec-compiler.git] / promise.cc
1 #include "promise.h"
2 #include "model.h"
3 #include "schedule.h"
4
5 bool Promise::increment_threads(thread_id_t tid) { 
6         unsigned int id=id_to_int(tid); 
7         if (id>=synced_thread.size()) {
8                 synced_thread.resize(id+1, false);
9         }
10         if (synced_thread[id])
11                 return false;
12         
13         synced_thread[id]=true;
14         bool * enabled=model->get_scheduler()->get_enabled();
15
16         for(unsigned int i=0;i<model->get_num_threads();i++) {
17                 if (!synced_thread[id] && enabled[id])
18                         return false;
19         }
20         return true;
21 }