From 7f0cad397924b6ec7fdacf41d331ff1407b8eca1 Mon Sep 17 00:00:00 2001 From: Reda Maher Date: Sun, 4 Oct 2020 23:35:17 +0200 Subject: [PATCH] Posix: just assert if a task returned from its main function --- portable/ThirdParty/GCC/Posix/port.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/portable/ThirdParty/GCC/Posix/port.c b/portable/ThirdParty/GCC/Posix/port.c index ae76e785a..7107a56f8 100644 --- a/portable/ThirdParty/GCC/Posix/port.c +++ b/portable/ThirdParty/GCC/Posix/port.c @@ -417,24 +417,6 @@ Thread_t *pxThreadToCancel = prvGetThreadFromTask( pxTaskToDelete ); } /*-----------------------------------------------------------*/ -static void prvTaskExitError( void ) -{ - /* A function that implements a task must not exit or attempt to return to - * its caller as there is nothing to return to. If a task wants to exit it - * should instead call vTaskDelete( NULL ). Artificially force an assert() - * to be triggered if configASSERT() is defined, then stop here so - * application writers can catch the error. */ - configASSERT( pdFALSE ); - - portDISABLE_INTERRUPTS(); - - while( 1 ) - { - /* Do Nothing */ - } -} -/*-----------------------------------------------------------*/ - static void *prvWaitForStart( void * pvParams ) { Thread_t *pxThread = pvParams; @@ -448,8 +430,12 @@ Thread_t *pxThread = pvParams; /* Call the task's entry point. */ pxThread->pxCode( pxThread->pvParams ); - /* Task function should not return */ - prvTaskExitError(); + /* A function that implements a task must not exit or attempt to return to + * its caller as there is nothing to return to. If a task wants to exit it + * should instead call vTaskDelete( NULL ). Artificially force an assert() + * to be triggered if configASSERT() is defined, so application writers can + * catch the error. */ + configASSERT( pdFALSE ); return NULL; }