From: Brian Norris Date: Thu, 3 May 2012 21:04:38 +0000 (-0700) Subject: threads: add parent info + get_parent() method X-Git-Tag: pldi2013~461 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b01017897db7a4000d3f6f024e0b3800d0f10790;p=model-checker.git threads: add parent info + get_parent() method --- diff --git a/threads.cc b/threads.cc index bc553b1..cc93931 100644 --- a/threads.cc +++ b/threads.cc @@ -87,6 +87,7 @@ Thread::Thread(thrd_t *t, void (*func)(), void *a) { state = THREAD_CREATED; id = model->get_next_id(); *user_thread = id; + parent = thread_current(); } Thread::~Thread() diff --git a/threads.h b/threads.h index 38eac0a..345f420 100644 --- a/threads.h +++ b/threads.h @@ -31,8 +31,10 @@ public: void set_state(thread_state s) { state = s; } thread_id_t get_id(); thrd_t get_thrd_t() { return *user_thread; } + Thread * get_parent() { return parent; } private: int create_context(); + Thread *parent; void (*start_routine)(); void *arg;