hashtable: make more flexible
[model-checker.git] / threads.cc
index ba7b54730781369fd6c17ec9f4bc492d660b3843..792014e62b4d3c88c1ecc052a4de120c25cace52 100644 (file)
@@ -23,10 +23,21 @@ Thread * thread_current(void)
        return model->scheduler->get_current_thread();
 }
 
-/* This method just gets around makecontext not being 64-bit clean */
-
+/**
+ * Provides a startup wrapper for each thread, allowing some initial
+ * model-checking data to be recorded. This method also gets around makecontext
+ * not being 64-bit clean
+ */
 void thread_startup() {
        Thread * curr_thread = thread_current();
+
+       /* TODO -- we should make this event always immediately follow the
+                CREATE event, so we don't get redundant traces...  */
+
+       /* Add dummy "start" action, just to create a first clock vector */
+       model->switch_to_master(new ModelAction(THREAD_START, std::memory_order_seq_cst, curr_thread));
+
+       /* Call the actual thread function */
        curr_thread->start_routine(curr_thread->arg);
 }