From 8362b1efa92635ab49bd937edf451e3b2e0981bc Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 6 Sep 2012 13:41:12 -0700 Subject: [PATCH] threads: add THREAD_BLOCKED state To signal that a Thread cannot yet be added back to the Scheduler's ready list. --- threads.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/threads.h b/threads.h index 25b1d64..9396760 100644 --- a/threads.h +++ b/threads.h @@ -28,6 +28,11 @@ typedef enum thread_state { * context. */ THREAD_READY, + /** + * Thread is waiting on another action (e.g., thread completion, lock + * release, etc.) + */ + THREAD_BLOCKED, /** Thread has completed its execution */ THREAD_COMPLETED } thread_state; @@ -71,6 +76,9 @@ public: /** @return True if this thread is finished executing */ bool is_complete() { return state == THREAD_COMPLETED; } + /** @return True if this thread is blocked */ + bool is_blocked() { return state == THREAD_BLOCKED; } + /** @return True if no threads are waiting on this Thread */ bool wait_list_empty() { return wait_list.empty(); } -- 2.34.1