diff options
author | Ching-Hsin,Lee <chinglee@amazon.com> | 2024-01-10 08:32:14 +0300 |
---|---|---|
committer | Paul Bartell <paul.bartell@gmail.com> | 2024-01-11 21:53:54 +0300 |
commit | 0fac0859af251a7bf33ebfc6c3f00f3fe0d7d6c5 (patch) | |
tree | 87c401a1f470592b49ef10f070e2bee2989dc147 | |
parent | 3dade5b5a5a1378ccab80718a1f501f7485a0fa1 (diff) |
Add back heap setup code
-rw-r--r-- | portable/ThirdParty/GCC/Posix/port.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/portable/ThirdParty/GCC/Posix/port.c b/portable/ThirdParty/GCC/Posix/port.c index d91255796..04f883119 100644 --- a/portable/ThirdParty/GCC/Posix/port.c +++ b/portable/ThirdParty/GCC/Posix/port.c @@ -105,8 +105,9 @@ static pthread_t hMainThread = ( pthread_t ) NULL; static volatile BaseType_t uxCriticalNesting; static BaseType_t xSchedulerEnd = pdFALSE; static pthread_t hTimerTickThread; +static bool xTimerTickThreadShouldRun; static uint64_t prvStartTimeNs; -static List_t xThreadList; /* The list to track all the pthreads which are not deleted. */ +static List_t xThreadList; /*-----------------------------------------------------------*/ static void prvSetupSignalsAndSchedulerPolicy( void ); @@ -277,7 +278,7 @@ BaseType_t xPortStartScheduler( void ) void vPortEndScheduler( void ) { /* Stop the timer tick thread. */ - pthread_cancel( hTimerTickThread ); + xTimerTickThreadShouldRun = false; pthread_join( hTimerTickThread, NULL ); /* Signal the scheduler to exit its loop. */ @@ -370,7 +371,6 @@ static uint64_t prvGetTimeNs( void ) return ( uint64_t ) t.tv_sec * ( uint64_t ) 1000000000UL + ( uint64_t ) t.tv_nsec; } - /*-----------------------------------------------------------*/ /* commented as part of the code below in vPortSystemTickHandler, @@ -379,7 +379,7 @@ static uint64_t prvGetTimeNs( void ) static void * prvTimerTickHandler( void * arg ) { - for( ; ; ) + while( xTimerTickThreadShouldRun ) { /* * signal to the active task to cause tick handling or @@ -399,7 +399,10 @@ static void * prvTimerTickHandler( void * arg ) usleep( portTICK_RATE_MICROSECONDS ); pthread_testcancel(); } + + return NULL; } +/*-----------------------------------------------------------*/ /* * Setup the systick timer to generate the tick interrupts at the required @@ -407,6 +410,7 @@ static void * prvTimerTickHandler( void * arg ) */ void prvSetupTimerInterrupt( void ) { + xTimerTickThreadShouldRun = true; pthread_create( &hTimerTickThread, NULL, prvTimerTickHandler, NULL ); prvStartTimeNs = prvGetTimeNs(); |