minor fix
[cdsspec-compiler.git] / benchmark / cliffc-hashtable / main.cc
index 6c75aff28849d0e77d3f77163e45153319c39a43..7641fc0a4b7d7cb1da9c47110828591ffb1ddac3 100644 (file)
@@ -19,8 +19,8 @@ slot* const cliffc_hashtable<TypeK, TypeV>::TOMBSTONE = new slot(false, NULL);
 
 class IntWrapper {
        private:
-           int _val;
                public:
+           int _val;
 
                IntWrapper(int val) : _val(val) {}
 
@@ -45,13 +45,33 @@ class IntWrapper {
                }
 };
 
-int user_main(int argc, char *argv[]) {
-       cliffc_hashtable<IntWrapper, IntWrapper> table;
-       IntWrapper k1(3), k2(4), v1(1), v2(2);
-       
 
+cliffc_hashtable<IntWrapper, IntWrapper> table;
+IntWrapper *val;
+
+void threadA(void *arg) {
+       IntWrapper k1(3), k2(4), v1(1), v2(2);
        table.put(k1, v1);
        table.put(k2, v2);
-       cout << table.get(k2)->get() << endl;
-       return 1;
+}
+
+void threadB(void *arg) {
+       IntWrapper k1(3), k2(4), v1(1), v2(2);
+       val = table.get(k2);
+}
+
+int user_main(int argc, char *argv[]) {
+       thrd_t t1, t2;
+       val = new IntWrapper(0);
+       thrd_create(&t1, threadA, NULL);
+       thrd_create(&t2, threadB, NULL);
+
+       thrd_join(t1);
+       thrd_join(t2);/*
+       if (val == NULL) {
+               cout << "NULL" << endl;
+       } else {
+               cout << val->get() << endl;
+       }*/
+       return 0;
 }