Skip to content

Commit 6776cb7

Browse files
authored
Merge pull request #5587 from slashdevteam/thread_terminate
Fix fatal parameter error when deleting/terminating Thread object
2 parents b544e8d + c08e0f5 commit 6776cb7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

rtos/Thread.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ osStatus Thread::terminate() {
129129
_tid = (osThreadId_t)NULL;
130130
if (!_finished) {
131131
_finished = true;
132-
ret = osThreadTerminate(local_id);
132+
// if local_id == 0 Thread was not started in first place
133+
// and does not have to be terminated
134+
if (local_id != 0) {
135+
ret = osThreadTerminate(local_id);
136+
}
133137
}
134138
_mutex.unlock();
135139
return ret;

0 commit comments

Comments
 (0)