From 3c82af9a449b5cb3322809fd195a02e4a2ae37f4 Mon Sep 17 00:00:00 2001
From: Brian Demsky <bdemsky@uci.edu>
Date: Thu, 6 Sep 2012 23:48:25 -0700
Subject: [PATCH] changes

---
 datarace.cc         | 5 +++--
 model.h             | 8 +++++---
 test/linuxrwlocks.c | 2 --
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/datarace.cc b/datarace.cc
index 34060fa..1cc407b 100644
--- a/datarace.cc
+++ b/datarace.cc
@@ -85,7 +85,8 @@ static void reportDataRace(thread_id_t oldthread, modelclock_t oldclock, bool is
 
 	/* If the race is realized, bail out now. */
 	if (checkDataRaces()) {
-		model->assert_thread();
+		model->set_assert();
+		model->switch_to_master(NULL);
 	}
 }
 
@@ -121,7 +122,7 @@ void printRace(struct DataRace * race) {
 	printf("Datarace detected\n");
 	printf("Location %p\n", race->address);
 	printf("Initial access: thread %u clock %u, iswrite %u\n",race->oldthread,race->oldclock, race->isoldwrite);
-	printf("Second access: thread %u, iswrite %u\n", race->newaction->get_tid(), race->isnewwrite);
+	printf("Second access: thread %u clock %u, iswrite %u\n", race->newaction->get_tid(), race->newaction->get_seq_number() , race->isnewwrite);
 }
 
 /** This function does race detection for a write on an expanded record. */
diff --git a/model.h b/model.h
index 9235f8f..74e3b06 100644
--- a/model.h
+++ b/model.h
@@ -53,7 +53,6 @@ public:
 	/** @return The currently executing Thread. */
 	Thread * get_current_thread() { return scheduler->get_current_thread(); }
 
-	void assert_thread();
 	int switch_to_master(ModelAction *act);
 	ClockVector * get_cv(thread_id_t tid);
 	ModelAction * get_parent_action(thread_id_t tid);
@@ -66,12 +65,15 @@ public:
 
 	void finish_execution();
 	bool isfeasibleprefix();
+	void set_assert() {asserted=true;}
 
 	MEMALLOC
 private:
 	/** The scheduler to use: tracks the running/ready Threads */
 	Scheduler *scheduler;
 
+	bool has_asserted() {return asserted;}
+	void reset_asserted() {asserted=false;}
 	int next_thread_id;
 	modelclock_t used_sequence_numbers;
 	int num_executions;
@@ -140,7 +142,7 @@ private:
 	/**
 	 * @brief The modification order graph
 	 *
-	 * A direceted acyclic graph recording observations of the modification
+	 * A directed acyclic graph recording observations of the modification
 	 * order on all the atomic objects in the system. This graph should
 	 * never contain any cycles, as that represents a violation of the
 	 * memory model (total ordering). This graph really consists of many
@@ -152,8 +154,8 @@ private:
 	 * <tt>b</tt>.
 	 */
 	CycleGraph *mo_graph;
-
 	bool failed_promise;
+	bool asserted;
 };
 
 extern ModelChecker *model;
diff --git a/test/linuxrwlocks.c b/test/linuxrwlocks.c
index 18e6ffb..a616b67 100644
--- a/test/linuxrwlocks.c
+++ b/test/linuxrwlocks.c
@@ -104,11 +104,9 @@ void user_main()
 	thrd_t t1, t2;
 	atomic_init(&mylock.lock, RW_LOCK_BIAS);
 
-	printf("Thread %d: creating 2 threads\n", thrd_current());
 	thrd_create(&t1, (thrd_start_t)&a, NULL);
 	thrd_create(&t2, (thrd_start_t)&a, NULL);
 	
 	thrd_join(t1);
 	thrd_join(t2);
-	printf("Thread %d is finished\n", thrd_current());
 }
-- 
2.34.1