From e32b258229de4971ccb0759888d2574363f08a12 Mon Sep 17 00:00:00 2001 From: Russ Butler Date: Mon, 8 Aug 2016 16:42:20 -0500 Subject: [PATCH] Fix joining a terminated thread When a thread is terminated signal the join semaphore so any threads joining the terminated thread wake up as expected. --- rtos/rtos/Thread.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rtos/rtos/Thread.cpp b/rtos/rtos/Thread.cpp index bd254a56ec..cb62d77165 100644 --- a/rtos/rtos/Thread.cpp +++ b/rtos/rtos/Thread.cpp @@ -104,6 +104,9 @@ osStatus Thread::terminate() { ret = osThreadTerminate(_tid); _tid = (osThreadId)NULL; + // Wake threads joining the terminated thread + _join_sem.release(); + _mutex.unlock(); return ret; }