From: Brian Norris Date: Sat, 6 Oct 2012 00:50:37 +0000 (-0700) Subject: threads: add constructor for model-checker thread X-Git-Url: http://plrg.eecs.uci.edu/git/?p=cdsspec-compiler.git;a=commitdiff_plain;h=d57536bfa2339bb6b51c8c72a2198425534b8ff6 threads: add constructor for model-checker thread This thread will never have its own stack, and it should never be inserted into the Scheduler. --- diff --git a/threads.cc b/threads.cc index e1f74bf..7f51515 100644 --- a/threads.cc +++ b/threads.cc @@ -2,6 +2,8 @@ * @brief Thread functions. */ +#include + #include "libthreads.h" #include "common.h" #include "threads.h" @@ -112,6 +114,31 @@ void Thread::complete() } } +/** + * @brief Construct a new model-checker Thread + * + * A model-checker Thread is used for accounting purposes only. It will never + * have its own stack, and it should never be inserted into the Scheduler. + * + * @param tid The thread ID to assign + */ +Thread::Thread(thread_id_t tid) : + parent(NULL), + creation(NULL), + pending(NULL), + start_routine(NULL), + arg(NULL), + stack(NULL), + user_thread(NULL), + id(tid), + state(THREAD_READY), /* Thread is always ready? */ + wait_list(), + last_action_val(0), + model_thread(true) +{ + memset(&context, 0, sizeof(context)); +} + /** * Construct a new thread. * @param t The thread identifier of the newly created thread. diff --git a/threads.h b/threads.h index 5e8cbef..7f005c0 100644 --- a/threads.h +++ b/threads.h @@ -35,6 +35,7 @@ class ModelAction; /** @brief A Thread is created for each user-space thread */ class Thread { public: + Thread(thread_id_t tid); Thread(thrd_t *t, void (*func)(void *), void *a); ~Thread(); void complete();