From b01017897db7a4000d3f6f024e0b3800d0f10790 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 3 May 2012 14:04:38 -0700 Subject: [PATCH] threads: add parent info + get_parent() method --- threads.cc | 1 + threads.h | 2 ++ 2 files changed, 3 insertions(+) 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; -- 2.34.1