model: privatize set_assert()
[c11tester.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         unsigned int sync_size=synced_thread.size();
15         int promise_tid=id_to_int(read->get_tid());
16         for(unsigned int i=1;i<model->get_num_threads();i++) {
17                 if ((i >= sync_size || !synced_thread[i]) && ( (int)i != promise_tid ) && model->is_enabled(int_to_id(i))) {
18                         return false;
19                 }
20         }
21         return true;
22 }
23
24 bool Promise::check_promise() {
25         unsigned int sync_size=synced_thread.size();
26         for(unsigned int i=1;i<model->get_num_threads();i++) {
27                 if ((i >= sync_size || !synced_thread[i]) && model->is_enabled(int_to_id(i))) {
28                         return false;
29                 }
30         }
31         return true;
32 }