promise: fixup style
authorBrian Norris <banorris@uci.edu>
Wed, 23 Jan 2013 00:24:44 +0000 (16:24 -0800)
committerBrian Norris <banorris@uci.edu>
Wed, 23 Jan 2013 00:24:44 +0000 (16:24 -0800)
promise.cc
promise.h

index 90591eb60249693d773c534dfbaedf96c4117521..62e2c9d24d67dbd2509faba6736bec62ea410f84 100644 (file)
@@ -2,28 +2,29 @@
 #include "model.h"
 #include "schedule.h"
 
-bool Promise::increment_threads(thread_id_t tid) { 
-       unsigned int id=id_to_int(tid); 
-       if ( id >= synced_thread.size() ) {
-               synced_thread.resize(id+1, false);
-       }
+bool Promise::increment_threads(thread_id_t tid)
+{
+       unsigned int id = id_to_int(tid);
+       if (id >= synced_thread.size())
+               synced_thread.resize(id + 1, false);
        if (synced_thread[id])
                return false;
-       
-       synced_thread[id]=true;
-       unsigned int sync_size=synced_thread.size();
-       int promise_tid=id_to_int(read->get_tid());
-       for(unsigned int i=1;i<model->get_num_threads();i++) {
-               if ((i >= sync_size || !synced_thread[i]) && ( (int)i != promise_tid ) && model->is_enabled(int_to_id(i))) {
+
+       synced_thread[id] = true;
+       unsigned int sync_size = synced_thread.size();
+       int promise_tid = id_to_int(read->get_tid());
+       for (unsigned int i = 1; i < model->get_num_threads(); i++) {
+               if ((i >= sync_size || !synced_thread[i]) && ((int)i != promise_tid) && model->is_enabled(int_to_id(i))) {
                        return false;
                }
        }
        return true;
 }
 
-bool Promise::check_promise() {
-       unsigned int sync_size=synced_thread.size();
-       for(unsigned int i=1;i<model->get_num_threads();i++) {
+bool Promise::check_promise() const
+{
+       unsigned int sync_size = synced_thread.size();
+       for (unsigned int i = 1; i < model->get_num_threads(); i++) {
                if ((i >= sync_size || !synced_thread[i]) && model->is_enabled(int_to_id(i))) {
                        return false;
                }
index 9ddaea8d6dbfb296f187df94f47141a6cf0376f4..3166c8f6f1603bfad9ba27124f60fcca73b55d41 100644 (file)
--- a/promise.h
+++ b/promise.h
@@ -30,7 +30,7 @@ class Promise {
                return synced_thread[id];
        }
 
-       bool check_promise();
+       bool check_promise() const;
        uint64_t get_value() const { return value; }
        void set_write(const ModelAction *act) { write = act; }
        const ModelAction * get_write() { return write; }
@@ -41,7 +41,7 @@ class Promise {
        const uint64_t value;
        const modelclock_t expiration;
        ModelAction * const read;
-       const ModelAction * write;
+       const ModelAction *write;
 };
 
 #endif