From 0997f5bf1b28a79066ed4abfed57f14419ee44d3 Mon Sep 17 00:00:00 2001 From: Brian Demsky Date: Sun, 24 Feb 2013 23:24:50 -0800 Subject: [PATCH] fix norris mentioned bug --- model.cc | 2 +- schedule.cc | 2 +- threads-model.h | 2 +- threads.cc | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/model.cc b/model.cc index 7fdc8246..24eb83db 100644 --- 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 */ diff --git a/schedule.cc b/schedule.cc index 8d44eec6..1bd1b0f9 100644 --- a/schedule.cc +++ b/schedule.cc @@ -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()) diff --git a/threads-model.h b/threads-model.h index fd0314ad..30acd2de 100644 --- a/threads-model.h +++ b/threads-model.h @@ -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(); diff --git a/threads.cc b/threads.cc index 1de548cc..cbedbb18 100644 --- a/threads.cc +++ b/threads.cc @@ -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 */ -- 2.34.1