Posix: Free Idle task resources after ending the scheduler

In case of using Posix simulator and ending the scheduler, it does
not free the resources allocated by the idle task. This
causes the memory checkers (Valgrind, Address Sanitizers, ..) to
complain.
This commit is contained in:
Reda Maher 2020-09-22 17:54:58 +02:00 committed by Reda Maher
parent d428209d01
commit e9a2d2701e

View file

@ -178,6 +178,7 @@ portBASE_TYPE xPortStartScheduler( void )
{
int iSignal;
sigset_t xSignals;
TaskHandle_t pxIdleThread;
hMainThread = pthread_self();
@ -185,6 +186,8 @@ sigset_t xSignals;
Interrupts are disabled here already. */
prvSetupTimerInterrupt();
pxIdleThread = xTaskGetIdleTaskHandle();
/* Start the first task. */
vPortStartFirstTask();
@ -197,6 +200,9 @@ sigset_t xSignals;
sigwait( &xSignals, &iSignal );
}
/* Cancel the Idle task and free its resources */
vPortCancelThread(pxIdleThread);
/* Restore original signal mask. */
(void)pthread_sigmask( SIG_SETMASK, &xSchedulerOriginalSignalMask, NULL );