From 6d07b6dd2442d2af16d3411cbbdcfd5519853ca4 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Tue, 22 Jan 2013 16:24:44 -0800 Subject: [PATCH] promise: fixup style --- promise.cc | 29 +++++++++++++++-------------- promise.h | 4 ++-- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/promise.cc b/promise.cc index 90591eb..62e2c9d 100644 --- a/promise.cc +++ b/promise.cc @@ -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;iget_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;iget_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; } diff --git a/promise.h b/promise.h index 9ddaea8..3166c8f 100644 --- 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 -- 2.34.1