From 3dade5b5a5a1378ccab80718a1f501f7485a0fa1 Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Wed, 10 Jan 2024 05:20:51 +0000 Subject: [PATCH] UPdate format --- portable/ThirdParty/GCC/Posix/port.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/portable/ThirdParty/GCC/Posix/port.c b/portable/ThirdParty/GCC/Posix/port.c index 391abe4ff..d91255796 100644 --- a/portable/ThirdParty/GCC/Posix/port.c +++ b/portable/ThirdParty/GCC/Posix/port.c @@ -106,7 +106,7 @@ static volatile BaseType_t uxCriticalNesting; static BaseType_t xSchedulerEnd = pdFALSE; static pthread_t hTimerTickThread; static uint64_t prvStartTimeNs; -static List_t xThreadList; /* The list to track all the pthreads which are not deleted. */ +static List_t xThreadList; /* The list to track all the pthreads which are not deleted. */ /*-----------------------------------------------------------*/ static void prvSetupSignalsAndSchedulerPolicy( void ); @@ -250,7 +250,7 @@ BaseType_t xPortStartScheduler( void ) for( pxIterator = listGET_HEAD_ENTRY( &xThreadList ); pxIterator != pxEndMarker; pxIterator = listGET_NEXT( pxIterator ) ) { - Thread_t *pxThread = ( Thread_t * ) listGET_LIST_ITEM_OWNER( pxIterator ); + Thread_t * pxThread = ( Thread_t * ) listGET_LIST_ITEM_OWNER( pxIterator ); pthread_cancel( pxThread->pthread ); pthread_join( pxThread->pthread, NULL ); @@ -377,9 +377,9 @@ static uint64_t prvGetTimeNs( void ) * to adjust timing according to full demo requirements */ /* static uint64_t prvTickCount; */ -static void* prvTimerTickHandler(void *arg) +static void * prvTimerTickHandler( void * arg ) { - for(;;) + for( ; ; ) { /* * signal to the active task to cause tick handling or @@ -389,13 +389,15 @@ static void* prvTimerTickHandler(void *arg) Thread_t * thread; hCurrentTask = xTaskGetCurrentTaskHandle(); + if( hCurrentTask != NULL ) { thread = prvGetThreadFromTask( hCurrentTask ); pthread_kill( thread->pthread, SIGALRM ); } + usleep( portTICK_RATE_MICROSECONDS ); - pthread_testcancel(); + pthread_testcancel(); } }