Skip to content

Commit

Permalink
Fix joining a terminated thread
Browse files Browse the repository at this point in the history
When a thread is terminated signal the join semaphore so any threads
joining the terminated thread wake up as expected.
  • Loading branch information
c1728p9 authored and 0xc0170 committed Aug 10, 2016
1 parent 80b1ff1 commit e32b258
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rtos/rtos/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit e32b258

Please sign in to comment.