diff --git a/rtos/Thread.cpp b/rtos/Thread.cpp index c168afde2f..9969e09670 100644 --- a/rtos/Thread.cpp +++ b/rtos/Thread.cpp @@ -179,11 +179,15 @@ int32_t Thread::signal_clr(int32_t signals) { Thread::State Thread::get_state() { #if !defined(__MBED_CMSIS_RTOS_CA9) && !defined(__MBED_CMSIS_RTOS_CM) #ifdef CMSIS_OS_RTX - State status = Deleted; + State status; _mutex.lock(); if (_tid != NULL) { status = (State)_thread_def.tcb.state; + } else if (_finished) { + status = Deleted; + } else { + status = Inactive; } _mutex.unlock(); diff --git a/rtos/Thread.h b/rtos/Thread.h index 1df34c3712..edad0840e9 100644 --- a/rtos/Thread.h +++ b/rtos/Thread.h @@ -252,7 +252,7 @@ public: /** State of the Thread */ enum State { - Inactive, /**< Not created or terminated */ + Inactive, /**< Not created */ Ready, /**< Ready to run */ Running, /**< Running */ WaitingDelay, /**< Waiting for a delay to occur */