fix norris mentioned bug
authorBrian Demsky <bdemsky@uci.edu>
Mon, 25 Feb 2013 07:24:50 +0000 (23:24 -0800)
committerBrian Demsky <bdemsky@uci.edu>
Mon, 25 Feb 2013 07:24:50 +0000 (23:24 -0800)
model.cc
schedule.cc
threads-model.h
threads.cc

index 7fdc824669588e216017846490751e14d69337eb..24eb83dbbc6515cb4c24730e27ee94c4c949afbe 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -1113,7 +1113,7 @@ bool ModelChecker::process_thread_action(ModelAction *curr)
        case THREAD_CREATE: {
                thrd_t *thrd = (thrd_t *)curr->get_location();
                struct thread_params *params = (struct thread_params *)curr->get_value();
-               Thread *th = new Thread(thrd, params->func, params->arg);
+               Thread *th = new Thread(thrd, params->func, params->arg, get_thread(curr));
                add_thread(th);
                th->set_creation(curr);
                /* Promises can be satisfied by children */
index 8d44eec6d7648b467aa2bc3bf0abfc1c3478ca38..1bd1b0f983fef2a602fe6b089db723c4526adc4a 100644 (file)
@@ -219,7 +219,7 @@ void Scheduler::set_current_thread(Thread *t)
 {
        ASSERT(t && !t->is_model_thread());
 
-       //      curr_thread_index = id_to_int(t->get_id());
+       //curr_thread_index = id_to_int(t->get_id());
 
        current = t;
        if (DBG_ENABLED())
index fd0314ad6b9fa34ac5a42c0fd9cfd94f6f552753..30acd2deba1f50e27a15d1c2d74a649809cf004a 100644 (file)
@@ -41,7 +41,7 @@ class ModelAction;
 class Thread {
 public:
        Thread(thread_id_t tid);
-       Thread(thrd_t *t, void (*func)(void *), void *a);
+       Thread(thrd_t *t, void (*func)(void *), void *a, Thread * parent_thrd = NULL);
        ~Thread();
        void complete();
 
index 1de548ccdb93ccd41a2a0248a49be2937dd87f01..cbedbb18bae1d73db1c46a531b4141886875b6be 100644 (file)
@@ -151,7 +151,7 @@ Thread::Thread(thread_id_t tid) :
  * @param func The function that the thread will call.
  * @param a The parameter to pass to this function.
  */
-Thread::Thread(thrd_t *t, void (*func)(void *), void *a) :
+Thread::Thread(thrd_t *t, void (*func)(void *), void *a, Thread * parent_thrd) :
        creation(NULL),
        pending(NULL),
        start_routine(func),
@@ -171,7 +171,7 @@ Thread::Thread(thrd_t *t, void (*func)(void *), void *a) :
 
        id = model->get_next_id();
        user_thread->priv = this;
-       parent = thread_current();
+       parent = parent_thrd ? parent_thrd : thread_current();
 }
 
 /** Destructor */