fix norris mentioned bug
[model-checker.git] / threads.cc
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 */