Skip to content

Commit 191596e

Browse files
committed
Set thread ID to NULL after termination
After a thread has been terminated set its ID to NULL since the handle is no longer valid. This prevents accidental use of a deleted thread.
1 parent efddaf4 commit 191596e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

rtos/rtos/Thread.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ osStatus Thread::terminate() {
102102
_mutex.lock();
103103

104104
ret = osThreadTerminate(_tid);
105+
_tid = (osThreadId)NULL;
105106

106107
_mutex.unlock();
107108
return ret;

0 commit comments

Comments
 (0)