Skip to content

Commit

Permalink
RTOS2/RTX5: Enhanced ThreadTerminate to not allow termination of idle…
Browse files Browse the repository at this point in the history
… or timer threads.
  • Loading branch information
JonatanAntoni committed Oct 18, 2017
1 parent ef55319 commit 7c4c592
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CMSIS/RTOS2/RTX/Source/rtx_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,13 @@ osStatus_t svcRtxThreadTerminate (osThreadId_t thread_id) {
return osErrorParameter;
}

// Don't allow termination of timer or idle thread
if ((thread == osRtxInfo.timer.thread) ||
(thread == osRtxInfo.thread.idle)) {
EvrRtxThreadError(thread, osErrorParameter);
return osErrorResource;
}

// Check object state
switch (thread->state & osRtxThreadStateMask) {
case osRtxThreadRunning:
Expand Down

0 comments on commit 7c4c592

Please sign in to comment.