fix bug
authorBrian Demsky <bdemsky@uci.edu>
Tue, 10 Jul 2012 22:01:44 +0000 (15:01 -0700)
committerBrian Demsky <bdemsky@uci.edu>
Tue, 10 Jul 2012 22:01:44 +0000 (15:01 -0700)
get rid of annoying compiler warning

hashtable.h
main.cc

index f372f9e7b96f0efb7f08d6574d768a6cc7cdf2db..b544988ebb187d7ea015940025dce76e573d5a9b 100644 (file)
@@ -19,7 +19,7 @@ template<typename _Key, typename _Val, typename _KeyInt, int _Shift>
                table = (struct hashlistnode<_Key,_Val> **) calloc(initialcapacity, sizeof(struct hashlistnode<_Key,_Val> *));
                loadfactor = factor;
                capacity = initialcapacity;
-               threshold = initialcapacity*loadfactor;
+               threshold = (unsigned int) (initialcapacity*loadfactor);
                mask = (capacity << _Shift)-1;
                size = 0; // Initial number of elements in the hash
        }
@@ -111,7 +111,7 @@ template<typename _Key, typename _Val, typename _KeyInt, int _Shift>
                
                table = newtable;          //Update the global hashtable upon resize()
                capacity = newsize;
-               threshold = newsize * loadfactor;
+               threshold = (unsigned int) (newsize * loadfactor);
                mask = (newsize << _Shift)-1;
                
                for(unsigned int i = 0; i < oldcapacity; i++) {
diff --git a/main.cc b/main.cc
index b38f7ef4816d003f45d876133dacf0dc0d816bab..a400fe3c2defff0eafc93e812b005f6b2b6fcf69 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -6,6 +6,8 @@
 #include "common.h"
 #include "threads.h"
 
+#include "datarace.h"
+
 /* global "model" object */
 #include "model.h"
 #include "snapshot-interface.h"
@@ -54,6 +56,8 @@ static void thread_wait_finish(void) {
 void real_main() {
        thrd_t user_thread;
        ucontext_t main_context;
+  //Initialize race detector
+  initRaceDetector();
 
        //Create the singleton SnapshotStack object
        snapshotObject = new SnapshotStack();