From a264f526ff8b81c28e8e781e28e6ea89f61eea9d Mon Sep 17 00:00:00 2001 From: arshi016 Date: Tue, 11 Oct 2022 14:23:41 -0400 Subject: [PATCH] Add warning message to ensure min stack size --- portable/ThirdParty/GCC/Posix/port.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/portable/ThirdParty/GCC/Posix/port.c b/portable/ThirdParty/GCC/Posix/port.c index c18705a494..bd0842fbf5 100644 --- a/portable/ThirdParty/GCC/Posix/port.c +++ b/portable/ThirdParty/GCC/Posix/port.c @@ -148,7 +148,12 @@ portSTACK_TYPE * pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, thread->xDying = pdFALSE; pthread_attr_init( &xThreadAttributes ); - pthread_attr_setstack( &xThreadAttributes, pxEndOfStack, ulStackSize ); + iRet = pthread_attr_setstack( &xThreadAttributes, pxEndOfStack, ulStackSize ); + if( iRet != 0 ) + { + fprintf( stderr, "[WARN] pthread_attr_setstack failed with return value: %d. Default stack will be used.\n", iRet ); + fprintf( stderr, "[WARN] Increase the stack size to PTHREAD_STACK_MIN.\n" ); + } thread->ev = event_create();