fix norris mentioned bug
[model-checker.git] / threads.cc
index a8f282a8b32efdb96d1d248570fc8b7574af92f7..cbedbb18bae1d73db1c46a531b4141886875b6be 100644 (file)
@@ -7,6 +7,7 @@
 #include <threads.h>
 #include "common.h"
 #include "threads-model.h"
+#include "action.h"
 
 /* global "model" object */
 #include "model.h"
@@ -150,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),
@@ -170,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 */