Posix: End Timer thread and free its resources after ending the scheduler

This commit is contained in:
Reda Maher 2020-09-28 01:37:07 +02:00 committed by Reda Maher
parent 1965a90613
commit e98ea9ef66

View file

@ -62,6 +62,7 @@
/* Scheduler includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "utils/wait_for_event.h"
/*-----------------------------------------------------------*/
@ -178,7 +179,6 @@ portBASE_TYPE xPortStartScheduler( void )
{
int iSignal;
sigset_t xSignals;
TaskHandle_t pxIdleThread;
hMainThread = pthread_self();
@ -186,8 +186,6 @@ TaskHandle_t pxIdleThread;
Interrupts are disabled here already. */
prvSetupTimerInterrupt();
pxIdleThread = xTaskGetIdleTaskHandle();
/* Start the first task. */
vPortStartFirstTask();
@ -201,7 +199,11 @@ TaskHandle_t pxIdleThread;
}
/* Cancel the Idle task and free its resources */
vPortCancelThread(pxIdleThread);
vPortCancelThread( xTaskGetIdleTaskHandle() );
#if ( configUSE_TIMERS == 1 )
/* Cancel the Timer task and free its resources */
vPortCancelThread( xTimerGetTimerDaemonTaskHandle() );
#endif /* configUSE_TIMERS */
/* Restore original signal mask. */
(void)pthread_sigmask( SIG_SETMASK, &xSchedulerOriginalSignalMask, NULL );