case THREAD_CREATE:
type_str = "thread create";
break;
+ case THREAD_START:
+ type_str = "thread start";
+ break;
case THREAD_YIELD:
type_str = "thread yield";
break;
* ModelAction */
typedef enum action_type {
THREAD_CREATE, /**< A thread creation action */
+ THREAD_START, /**< First action in each thread */
THREAD_YIELD, /**< A thread yield action */
THREAD_JOIN, /**< A thread join action */
ATOMIC_READ, /**< An atomic read action */
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();
+
+ /* Add dummy "start" action, just to create a first clock vector */
+ model->switch_to_master(new ModelAction(THREAD_START, memory_order_seq_cst, curr_thread));
+
+ /* Call the actual thread function */
curr_thread->start_routine(curr_thread->arg);
}