Skip to content

Commit 1d20f0e

Browse files
arshi016alfred2g
andauthored
Add warning message to ensure min stack size (#575)
Co-authored-by: alfred gedeon <[email protected]>
1 parent 963abe6 commit 1d20f0e

File tree

1 file changed

+6
-1
lines changed
  • portable/ThirdParty/GCC/Posix

1 file changed

+6
-1
lines changed

portable/ThirdParty/GCC/Posix/port.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,12 @@ portSTACK_TYPE * pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack,
148148
thread->xDying = pdFALSE;
149149

150150
pthread_attr_init( &xThreadAttributes );
151-
pthread_attr_setstack( &xThreadAttributes, pxEndOfStack, ulStackSize );
151+
iRet = pthread_attr_setstack( &xThreadAttributes, pxEndOfStack, ulStackSize );
152+
if( iRet != 0 )
153+
{
154+
fprintf( stderr, "[WARN] pthread_attr_setstack failed with return value: %d. Default stack will be used.\n", iRet );
155+
fprintf( stderr, "[WARN] Increase the stack size to PTHREAD_STACK_MIN.\n" );
156+
}
152157

153158
thread->ev = event_create();
154159

0 commit comments

Comments
 (0)